#include "DHTesp.h"
#define dhtPin 18
DHTesp dhtSensor;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
dhtSensor.setup(dhtPin, DHTesp::DHT22);
}
void loop() {
// put your main code here, to run repeatedly:
TempAndHumidity data = dhtSensor.getTempAndHumidity();
Serial.println("Temperature : "+String(data.temperature,2)+" C");
Serial.println("Humidity : "+String(data.humidity,1)+" %");
delay(10); // this speeds up the simulation
}
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4
dht1:VCC
dht1:SDA
dht1:NC
dht1:GND