2023-03-15 01:53:25 +01:00
|
|
|
#include <Arduino.h>
|
|
|
|
#include <DHT.h>
|
|
|
|
|
2023-03-15 02:47:49 +01:00
|
|
|
#define DHTTYPE DHT11
|
|
|
|
#define DHTPIN 4
|
|
|
|
|
|
|
|
DHT dht(DHTPIN, DHTTYPE);
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(9600);
|
|
|
|
dht.begin();
|
|
|
|
}
|
2023-03-15 01:53:25 +01:00
|
|
|
|
|
|
|
void loop() {
|
2023-03-15 02:47:49 +01:00
|
|
|
char buffer[100];
|
|
|
|
sprintf(buffer, "Temperature: %.2f °C Humidity: %.2f %%",
|
|
|
|
dht.readTemperature(), dht.readHumidity());
|
|
|
|
Serial.println(buffer);
|
|
|
|
delay(60000);
|
2023-03-15 01:53:25 +01:00
|
|
|
}
|