Skip to content

Instantly share code, notes, and snippets.

@orymate
Created July 9, 2016 13:52
Show Gist options
  • Save orymate/1d07994634a47df88f80a804c5cbe11c to your computer and use it in GitHub Desktop.
Save orymate/1d07994634a47df88f80a804c5cbe11c to your computer and use it in GitHub Desktop.
DHT
// 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