Exemplo n.º 1
0
 private static SensorReading <float> GetTemperatureReading(RTIMUSettings settings)
 {
     using (var humiditySensor = settings.CreateHumidity())
     {
         try
         {
             var reading = humiditySensor.Read();
             return(new SensorReading <float>
             {
                 room = RoomName,
                 sensor = "temperature",
                 value = CelsiusToFarenheight(reading.Temperatur)
             });
         }
         catch (System.Exception e)
         {
             Console.WriteLine("Error reading from temperature sensor");
             Console.WriteLine(e.Message);
             return(null);
         }
     }
 }
Exemplo n.º 2
0
 private static SensorReading <float> GetHumidityReading(RTIMUSettings settings)
 {
     using (var humiditySensor = settings.CreateHumidity())
     {
         try
         {
             var reading = humiditySensor.Read();
             return(new SensorReading <float>
             {
                 room = RoomName,
                 sensor = "humidity",
                 value = reading.Humidity
             });
         }
         catch (System.Exception e)
         {
             Console.WriteLine("Error reading from humidity sensor");
             Console.WriteLine(e.Message);
             return(null);
         }
     }
 }