rieccomi ho rifatto il codice...
cosi' funziona..
#include "DHT.h"
#define DHTPIN 33 //--> Defines the Digital Pin connected to the DHT11 sensor.
#define DHTTYPE DHT11 //--> Defines the type of DHT sensor used. Here used is the DHT11 sensor.
DHT dht11_sensor(DHTPIN, DHTTYPE); //--> Initialize DHT sensor.
String send_ID_Board = "#1";
float send_Temp;
int send_Humd;
String send_Status_Read_DHT11 = "";
void setup() {
Serial.begin(115200);
Serial.println();
}
void loop() {
delay(2000);
Serial.println();
Serial.println("-------------");
Serial.print("ESP32 ");
Serial.println(send_ID_Board);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
// Read temperature as Celsius (the default)
send_Temp = dht11_sensor.readTemperature();
// Read Humidity
send_Humd = dht11_sensor.readHumidity();
// Read temperature as Fahrenheit (isFahrenheit = true)
// float ft = dht11_sensor.readTemperature(true);
// Check if any reads failed.
if (isnan(send_Temp) || isnan(send_Humd)) {
Serial.println("Failed to read from DHT sensor!");
send_Temp = 0.00;
send_Humd = 0;
send_Status_Read_DHT11 = "FAILED";
} else {
send_Status_Read_DHT11 = "SUCCEED";
}
Serial.printf("Temperature : %.2f °C\n", send_Temp);
Serial.printf("Humidity : %d %%\n", send_Humd);
Serial.printf("Status Read DHT11 Sensor : %s\n", send_Status_Read_DHT11);
Serial.println("-------------");
}
se invece utilizzo il gpio34 sul esp32 non funziona..
#define DHTPIN 34 //--> Defines the Digital Pin connected to the DHT11 sensor.
ho la necessita di collegarmi al gpio34 peche ho gia ordinato la scheda a pcbway..