#include <DHTesp.h>
DHTesp dht;
TempAndHumidity data;
const int DHT_PIN=16;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);//output framelet(9600 slow)
//Serial.println("Hello, ESP32!");
dht.setup(DHT_PIN,DHTesp::DHT22);
}
void loop() {
data=dht.getTempAndHumidity();
Serial.println("Humi:"+String(data.humidity,1));
Serial.println("Temp:"+String(data.temperature,2));
Serial.println("---------------------");
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
}
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4