Esempio n. 1
0
        private void Timer_Gas_Tick(GT.Timer timer)
        {
            temp = s.getTemp().BinToCelsius().ToString();
            //DateTime startDate = DateTime.Now;
            DateTime startDate = RealTimeClock.GetDateTime();

            Debug.Print("Sending: " + temp + " - " + startDate.ToString("yyyyMMddHHmmss"));
            lpg = sens.MQGetGasPercentage(sens.MQRead() / sens.R0, gas_type.LPG).ToString();
            Debug.Print("Gpl: " + lpg);
            co = sens.MQGetGasPercentage(sens.MQRead() / sens.R0, gas_type.CO).ToString();
            Debug.Print("CO: " + co);
            smoke = sens.MQGetGasPercentage(sens.MQRead() / sens.R0, gas_type.SMOKE).ToString();
            Debug.Print("Smoke: " + smoke);

            server.pushData(temp, lpg, co, smoke, startDate.ToString("yyyyMMddHHmmss"));
        }
Esempio n. 2
0
        void ProgramStarted()
        {
            first     = true;
            time_sett = Resources.GetString(Resources.StringResources.PIR_Sensor);

            #region SENSORE TEMPERATURA
            s = new Sensore_Temperatura_43();
            s.setup();
            Temperatura t     = s.getTemp();
            double      valor = t.BinToCelsius();
            #endregion

            #region SERVER
            server = new DomoteerWebServer(ethernetJ11D, multicolorLED, displayT35, s);
            server.initConnection();
            server.RunWebServer();


            #endregion

            #region PIR

            pir = new PIR_Module(extender, server);

            #endregion

            #region SENSORE GAS
            sens = new Gas_Sensor(extender);
            #endregion

            #region TIMER_GAS
            timer_gas       = new GT.Timer(20000);
            timer_gas.Tick += new GT.Timer.TickEventHandler(Timer_Gas_Tick);
            timer_gas.Start();

            #endregion

            #region TIMER_AGGIORNAMENTO_SCHERMO
            timer_display       = new GT.Timer(5000);
            timer_display.Tick += new GT.Timer.TickEventHandler(Timer_Display_Tick);
            timer_display.Start();
            #endregion

            button.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(GetTemperatures);

            setupWindow();
        }