Exemple #1
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            hgd = new HomeOSGadgeteer.HomeOSGadgeteerDevice("MicrosoftResearch", "RelaySwitch", "abcdefgh", wifi,
                                                            null, null, /*usbSerial.SerialLine.PortName*/ null, null, null, () => { return(GT.Timer.GetMachineTime() < RemoteControlLedEndTime); }, true);

            hgd.SetupWebEvent("IsOn").WebEventReceived += this.RelayWebEventReceived;

            this.SwitchAndWait();

            GT.Timer relayTimer = new GT.Timer(RelayCheckPeriod);
            relayTimer.Tick += relayTimer_Tick;
            relayTimer.Start();

            Debug.Print("Program Started");
        }
Exemple #2
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            hgd = new HomeOSGadgeteer.HomeOSGadgeteerDevice("MicrosoftResearch", "LightSensor", "abcdefgh", wifi,
                                                            null, null, /*usbSerial.SerialLine.PortName*/ null, null, null, () => { return(GT.Timer.GetMachineTime() < RemoteControlLedEndTime); }, true);

            this.joystick.JoystickPressed += joystick_JoystickPressed;

            hgd.SetupWebEvent("light").WebEventReceived += this.LightWebEventReceived;

            GT.Timer lightTimer = new GT.Timer(LightCheckPeriod);
            lightTimer.Tick += new GT.Timer.TickEventHandler(this.lightTimer_Tick);
            lightTimer.Start();

            Debug.Print("Program Started");
        }
Exemple #3
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            hgd = new HomeOSGadgeteer.HomeOSGadgeteerDevice("MicrosoftResearch", "TempHumiditySensor", "abcdefgh", wifi,
                                                            null, null, /*usbSerial.SerialLine.PortName*/ null, null, null, () => { return(GT.Timer.GetMachineTime() < RemoteControlLedEndTime); }, true);

            //this.joystick.JoystickPressed += joystick_JoystickPressed;

            //hgd.SetupWebEvent("temp").WebEventReceived += this.LightWebEventReceived;
            this.button.TurnLEDOff();
            this.button.ButtonPressed += button_ButtonPressed;

            GT.Timer timer = new GT.Timer(CheckPeriod);
            timer.Tick += Timer_Tick;
            timer.Start();

            GT.Timer timerReboot = new GT.Timer(ResetPeriod);
            timerReboot.Tick += timerReboot_Tick;
            timerReboot.Start();


            hgd.SetupWebEvent("temperature").WebEventReceived += TempHumidityWebEventReceived;

            Debug.Print("Program Started");

            this.temperatureHumidity.MeasurementComplete += temperatureHumidity_MeasurementComplete;
            this.temperatureHumidity.StartContinuousMeasurements();

            /*******************************************************************************************
            *  Modules added in the Program.gadgeteer designer view are used by typing
            *  their name followed by a period, e.g.  button.  or  camera.
            *
            *  Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
            *   button.ButtonPressed +=<tab><tab>
            *
            *  If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
            *   GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
            *   timer.Tick +=<tab><tab>
            *   timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
        }
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            hgd = new HomeOSGadgeteer.HomeOSGadgeteerDevice("MicrosoftResearch", "MoistureSensor", "abcdefgh", wifi,
                multicolorLed, null, usbSerial.SerialLine.PortName, null, null, () => { return GT.Timer.GetMachineTime() < RemoteControlLedEndTime; },false);

            resetButton.LEDMode = Button.LEDModes.OnWhilePressed;
            resetButton.ButtonPressed += new Button.ButtonEventHandler(resetButton_ButtonPressed);
            resetButton.ButtonReleased += new Button.ButtonEventHandler(resetButton_ButtonReleased);

            usbHost.USBDriveConnected += (sender,storagedevice) => hgd.StorageAttached(storagedevice);
            sdCard.SDCardMounted += (sender, storagedevice) => hgd.StorageAttached(storagedevice);

            hgd.SetupWebEvent("moisture").WebEventReceived += MoistureWebEventReceived;
            hgd.SetupWebEvent("led").WebEventReceived += LedWebEventReceived;

            GT.Timer moistureTimer = new GT.Timer(MoistureCheckPeriod);
            moistureTimer.Tick += new GT.Timer.TickEventHandler(moistureTimer_Tick);
            moistureTimer.Start();
            
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
        }
Exemple #5
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            hgd = new HomeOSGadgeteer.HomeOSGadgeteerDevice("MicrosoftResearch", "MoistureSensor", "abcdefgh", wifi,
                                                            multicolorLed, null, usbSerial.SerialLine.PortName, null, null, () => { return(GT.Timer.GetMachineTime() < RemoteControlLedEndTime); }, false);

            resetButton.LEDMode         = Button.LEDModes.OnWhilePressed;
            resetButton.ButtonPressed  += new Button.ButtonEventHandler(resetButton_ButtonPressed);
            resetButton.ButtonReleased += new Button.ButtonEventHandler(resetButton_ButtonReleased);

            usbHost.USBDriveConnected += (sender, storagedevice) => hgd.StorageAttached(storagedevice);
            sdCard.SDCardMounted      += (sender, storagedevice) => hgd.StorageAttached(storagedevice);

            hgd.SetupWebEvent("moisture").WebEventReceived += MoistureWebEventReceived;
            hgd.SetupWebEvent("led").WebEventReceived      += LedWebEventReceived;

            GT.Timer moistureTimer = new GT.Timer(MoistureCheckPeriod);
            moistureTimer.Tick += new GT.Timer.TickEventHandler(moistureTimer_Tick);
            moistureTimer.Start();

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
        }