/// <summary> /// Print data read from sensor DHT /// </summary> /// <param name="dhtSensor">Sensor DHT used</param> private static void PrintDHT11Mesure(Dht11Sensor dhtSensor) { Debug.Print("Temp Celsius = " + dhtSensor.Temperature.ToString("F1") + "°C"); //Debug.Print("Temp Kelvin = " + dhtSensor.TemperatureKelvin.ToString("F1") + "°K"); //Debug.Print("Temp Farenhein = " + dhtSensor.TemperatureFarenheit.ToString("F1") + "°F"); Debug.Print(String.Empty); Debug.Print("Humidity = " + dhtSensor.Humidity.ToString("F1") + " %"); Debug.Print(String.Empty); }
/// <summary> /// Read data from DHT and print /// </summary> /// <param name="dhtSensor">Sensor DHT</param> /// <param name="cnt">A counter</param> public static void ReadDHT(Dht11Sensor dhtSensor) { if (dhtSensor.Read()) { //Debug.Print(cnt.ToString() + ":"); Debug.Print("\n----------------------------------------"); Debug.Print("Data: " + DateTime.Now.ToString()); PrintDHT11Mesure(dhtSensor); } else { /* first time always fail than it correct itself */ Debug.Print("DHT sensor Read() failed"); Thread.Sleep(2000); } }