#include <DHT.h>
#define DHTPIN 5
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
dht.begin();
}
void tampilan_data() {
// put your main code here, to run repeatedly:
float suhu = dht.readTemperature();
float lembab = dht.readHumidity();
// DISPLAY DATA
Serial.print("Suhu : ");
Serial.print(suhu);
Serial.print(", Kelembapan : ");
Serial.println(lembab);
}
void loop (){
tampilan_data();
delay(2000);
}