Created
July 9, 2016 13:52
-
-
Save orymate/1d07994634a47df88f80a804c5cbe11c to your computer and use it in GitHub Desktop.
DHT
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
// https://codeload.github.com/niesteszeck/idDHT11/zip/master | |
#include "DHT.h" | |
DHT dht; | |
void setup() | |
{ | |
Serial.begin(9600); | |
Serial.println(); | |
Serial.println("Pin\tStatus\tHumidity (%)\tTemperature (C)"); | |
} | |
void printData(int pin) { | |
dht.setup(pin); | |
float humidity = dht.getHumidity(); | |
float temperature = dht.getTemperature(); | |
Serial.print(pin); | |
Serial.print("\t"); | |
Serial.print(dht.getStatusString()); | |
Serial.print("\t"); | |
Serial.print(humidity, 1); | |
Serial.print("\t\t"); | |
Serial.print(temperature, 1); | |
Serial.println(); | |
} | |
void loop() | |
{ | |
delay(dht.getMinimumSamplingPeriod()); | |
printData(2); | |
printData(3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment