Ejemplo n.º 1
0
 private void InitializeModules() {
     Microsoft.SPOT.Debug.Print("The module \'ethernetENC28\' was not connected in the designer and will be null.");
     this.moisture = new GTM.GHIElectronics.Moisture(4);
     this.lightSense = new GTM.GHIElectronics.LightSense(2);
     this.relayX1 = new GTM.GHIElectronics.RelayX1(7);
     this.usbClientDP = new GTM.GHIElectronics.USBClientDP(8);
 }
 private void InitializeModules() {
     this.usbClientDP = new GTM.GHIElectronics.USBClientDP(1);
     this.moisture = new GTM.GHIElectronics.Moisture(10);
     this.lightSense = new GTM.GHIElectronics.LightSense(9);
     this.display = new GTM.GHIElectronics.DisplayTE35(14, 13, 12, Socket.Unused);
     this.ethernet = new GTM.GHIElectronics.EthernetJ11D(7);
     this.gps = new GTM.GHIElectronics.GPS(11);
 }
 private void InitializeModules()
 {
     this.usbClientDP = new GTM.GHIElectronics.USBClientDP(1);
     this.moisture = new GTM.GHIElectronics.Moisture(10);
     this.lightSense = new GTM.GHIElectronics.LightSense(9);
     this.display = new GTM.GHIElectronics.DisplayTE35(14, 13, 12, Socket.Unused);
     this.ethernet = new GTM.GHIElectronics.EthernetJ11D(7);
     this.gps = new GTM.GHIElectronics.GPS(11);
 }
Ejemplo n.º 4
0
 private void InitializeModules()
 {
     this.usbClientEDP = new GTM.GHIElectronics.USBClientEDP(1);
     this.sdCard       = new GTM.GHIElectronics.SDCard(5);
     this.moisture     = new GTM.GHIElectronics.Moisture(9);
     this.breakout     = new GTM.GHIElectronics.Breakout(14);
     this.wifiRS21     = new GTM.GHIElectronics.WiFiRS21(6);
     this.lightSense   = new GTM.GHIElectronics.LightSense(10);
 }
Ejemplo n.º 5
0
 private void InitializeModules()
 {
     this.usbClientSP = new GTM.GHIElectronics.USBClientSP(1);
     this.light       = new GTM.GHIElectronics.LightSense(10);
     this.temp        = new GTM.GHIElectronics.TempHumidSI70(11);
     this.moisture    = new GTM.GHIElectronics.Moisture(9);
     this.camera      = new GTM.GHIElectronics.Camera(3);
     this.ethernet    = new GTM.GHIElectronics.EthernetJ11D(7);
     this.ledStrip    = new GTM.GHIElectronics.LEDStrip(14);
     this.breakout    = new GTM.GHIElectronics.Breakout(12);
 }
        /// <summary>
        /// Read all sensors and validate readings, with specifices
        /// </summary>
        /// <param name="sqldb">Database to insert</param>
        /// <param name="moisture">A moinsture sensor</param>
        public void Read_and_check_values(SQL_Wrapper sqldb, Gadgeteer.Modules.GHIElectronics.Moisture moisture, Gadgeteer.Modules.GHIElectronics.LightSense lightSense)
        {
            /*Read and Print data*/
            Utilità.ReadDHT(dhtSensor);

            if (dhtSensor.Temperature != _last_tm.value || counterTm == 15)
            {
                _last_tm.value = dhtSensor.Temperature;
                TemperatureMisure tm = new TemperatureMisure(dhtSensor.Temperature, "OK");
                //obj_send.addMisure(tm);
                sqldb.insert(tm, 0);
                if (counterTm == 15)
                {
                    counterTm = 0;
                }
            }
            else
            {
                counterTm++;
            }

            if ((dhtSensor.Humidity != _last_hm.value && dhtSensor.Humidity != 0) || counterHm == 15)
            {
                _last_hm.value = dhtSensor.Humidity;
                HumidityMisure hm = new HumidityMisure(dhtSensor.Humidity, "OK");
                //obj_send.addMisure(hm);
                sqldb.insert(hm, 0);
                if (counterHm == 15)
                {
                    counterHm = 0;
                }
            }
            else
            {
                counterHm++;
            }

            float moinstureData = moisture.ReadMoisture();

            Debug.Print("Moinsture      = " + moinstureData);
            if ((moinstureData != _last_mm.value && moinstureData != 0) || counterMm == 15)
            {
                _last_mm.value = moinstureData;
                MoistureMisure mm = new MoistureMisure(moinstureData, "OK");
                //obj_send.addMisure(mm);
                sqldb.insert(mm, 0);
                if (counterMm == 15)
                {
                    counterMm = 0;
                }
            }
            else
            {
                counterMm++;
            }

            Debug.Print(String.Empty);

            double lightDataIll  = lightSense.GetIlluminance();
            double lightDataPro  = lightSense.ReadProportion();
            double lightDataVolt = lightSense.ReadVoltage();

            Debug.Print("LightSenseIll  = " + lightDataIll);
            Debug.Print("LightSensePro  = " + lightDataPro);
            Debug.Print("LightSenseVolt = " + lightDataVolt);
            if (lightDataIll < (_last_ls.value * 0.85) || lightDataIll > (_last_ls.value + _last_ls.value * 0.15) || counterLs == 15)
            {
                _last_ls.value = (float)lightDataIll;
                LightMisure ls = new LightMisure((float)lightDataIll, "OK");
                //obj_send.addMisure(ls);
                sqldb.insert(ls, 0);
                if (counterLs == 15)
                {
                    counterLs = 0;
                }
            }
            else
            {
                counterLs++;
            }
        }