problem with temperature and level water sensor.

Hi, I made a sketch with the water level sensor when the sensor goes below a reange I activate a red LED . the same thing I did with the temperature sensor but I’m not taking the led . because? thanks in advance.

Display_4prova_zan.ino (3.54 KB)

Hi Zanred, welcome to the forum.

Its better to paste your code between code-tags (</>) than attach it- makes it easier to read.

You seem to confuse the temperature value read from the DHT11 with the pin for the LED to indicate that temperature

I suspect you actually want something like

    Serial.print("Umidita'    (%): ");
    Serial.println(DHT11.humidity, DEC);
    Serial.print("Temperatura (C): ");
    Serial.print(DHT11.temperature, DEC);
    if ( DHT11.temperature >= 28)

But this still leaves the problem that the pin you are trying to use to flash your LED is the same (2) as the input pin of the sensor. You will have to work out which pin is connected to the DHT11 and which pin is used for the LED and change your code to make it right.

To avoid confusion I suggest you rename “DHT11temperature” to something more explanatory like “overTemperatureLED”