Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Name: mod7_DHT22_serialMonitor.ino
- * Date: 2021/10/14
- * Author: fsc
- * Version 1.0
- * https://wokwi.com/arduino/projects/313592512079987266
- */
- #include "DHT.h"
- #define DHTPIN 5 // DHT22 an Pin 5
- #define DHTTYPE DHT22 // DHT22 auswählen
- DHT dht(DHTPIN, DHTTYPE); // Objekt mit Parameter anlegen
- float humidity, temperature;
- void setup()
- {
- Serial.begin(9600);
- dht.begin();
- }
- void loop()
- {
- delay(2000);
- humidity = dht.readHumidity();
- temperature = dht.readTemperature();
- Serial.println("Humidity: " + String(humidity) + "%");
- Serial.println("Temperature: " + String(temperature) + "°C");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement