Supporting code snippets for http://everydaylifein.net/iot/arduino-dht-sensor-protocol.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <DHTSensor.h> | |
DHTSensor sensor(3);//Will be using pin3 for collecting the data | |
void loop() | |
{ | |
DHTSensorMeasurement re = sensor.Read(); | |
if (!re.HasError()) | |
{ | |
Serial.print("H: "); | |
Serial.print(re.Humidity()); | |
Serial.print(" T: "); | |
Serial.print(re.TemperatureInCelsius()); | |
Serial.print(" T(F): "); | |
Serial.print(re.TemperatureInFahrenheit()); | |
Serial.print(" T(K): "); | |
Serial.println(re.TemperatureInKelvin()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Will be using pin3 for collecting the data and pin7 for powering up the sensor | |
DHTSensor sensor(3, 7); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment