Skip to content

Instantly share code, notes, and snippets.

@ktinkerer
Created October 10, 2017 09:15
Show Gist options
  • Save ktinkerer/a48556dc0ff3b7b06e7d9a323f53aede to your computer and use it in GitHub Desktop.
Save ktinkerer/a48556dc0ff3b7b06e7d9a323f53aede to your computer and use it in GitHub Desktop.
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup(void) {
Serial.begin(9600);
dht.begin();
}
void loop(void) {
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
Serial.print(" Humidity: ");
Serial.print(h);
Serial.print(", Temperature: ");
Serial.println(t);
delay(60000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment