Exemplo n.º 1
0
        private void textMain(object sender, object e)
        {
            Moisture      = arduino.analogRead("A2");
            Temperature   = arduino.analogRead("A1");
            Rotation      = arduino.analogRead("A0");
            Ambient_light = arduino.analogRead("A3");

            breath_light();
            water_flower();
            Tem_warnning();

            //ConnectTheDotsSensor sensor1 = ctdHelper1.sensors.Find(item => item.guid == "2198a348-e2f9-4438-ab23-82a3930662ac");
            ConnectTheDotsSensor sensor1 = ctdHelper1.sensors.Find(item => item.measurename == "Temperature");

            sensor1.value = Tem;
            ctdHelper1.SendSensorData(sensor1);

            //ConnectTheDotsSensor sensor2 = ctdHelper2.sensors.Find(item => item.guid == "2298a348-e2f9-4438-ab23-82a3930662ac");
            ConnectTheDotsSensor sensor2 = ctdHelper2.sensors.Find(item => item.measurename == "light");

            sensor2.value = Ambient_light;
            ctdHelper2.SendSensorData(sensor2);

            //ConnectTheDotsSensor sensor3 = ctdHelper3.sensors.Find(item => item.guid == "2398a348-e2f9-4438-ab23-82a3930662ac");
            ConnectTheDotsSensor sensor3 = ctdHelper3.sensors.Find(item => item.measurename == "humidity");

            sensor3.value = Moisture;
            ctdHelper3.SendSensorData(sensor3);

            Debug.WriteLine("Temp:" + Temperature + ", Light:" + Ambient_light + ", Moisture:" + Moisture);
        }
 public void SendSensorData(ConnectTheDotsSensor sensor)
 {
     sensor.timecreated = DateTime.UtcNow.ToString("o");
     sendMessage(sensor.ToJson());
 }
 public void SendSensorData(ConnectTheDotsSensor sensor)
 {
     sensor.timecreated = DateTime.UtcNow.ToString("o");
     sendMessage(sensor.ToJson());
 }