
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float t = dht.readTemperature();
Serial.print("Temp: ");
Serial.println(t);
delay(2000);
}
Tip: Always check where you place your sensors. Data is only useful if it’s accurate.
