Пример #1
0
        private void Timer_Tick(object sender, object e)
        {
            ConnectTheDotsSensor sensor = ctdHelper.sensors.Find(item => item.measurename == "Sound");

            try
            {
                int soundValue = soundsensor.SensorValue();
                sensor.value = soundValue;
                lcd.SetText("S: " + soundValue.ToString());
                ctdHelper.SendSensorData(sensor);
            }
            catch (Exception)
            {
                // Bad sensor read
                lcd.SetText("Read or send failed");
            }
        }
Пример #2
0
 public void SendSensorData(ConnectTheDotsSensor sensor)
 {
     sensor.timecreated = DateTime.UtcNow.ToString("o");
     sendMessage(sensor.ToJson());
 }