Help I don't know what to do

I'm making a circuit with a temperature sensor. When the temperature goes above 40ºC, a hot display appears and a red LED turns on; if the temperature is between 18º and 25ºC the display says mild and a green LED lights up; and if it is at 15ºC it appears cold on the display and a blue LED lights up

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <LiquidCrystal_I2C.h>

Adafruit_BMP280 bmp;

LiquidCrystal_I2C lcd(0x27, 16, 2); // Endereço I2C do display LCD

const int redLed = 8;
const int greenLed = 10;
const int blueLed = 9;

void setup() {
Serial.begin(9600);

if (!bmp.begin()) {
Serial.println("Erro ao iniciar o sensor BMP280. Verifique as conexões!");
while (1);
}

lcd.begin(16, 2);
lcd.clear();
lcd.print("Monitor de Temp.");

pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(blueLed, OUTPUT);
}

void loop() {
float temperatura = bmp.readTemperature();

Serial.print("Temperatura: ");
Serial.print(temperatura);
Serial.println(" °C");

if (temperatura > 40.0) {
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);
digitalWrite(blueLed, LOW);
lcd.clear();
lcd.print("QUENTE");
} else if (temperatura >= 18.0 && temperatura <= 24.0) {
digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
digitalWrite(blueLed, LOW);
lcd.clear();
lcd.print("AMENO");
} else if (temperatura < 17.0) {
digitalWrite(redLed, LOW);
digitalWrite(greenLed, LOW);
digitalWrite(blueLed, HIGH);
lcd.clear();
lcd.print("FRIO");
} else {
digitalWrite(redLed, LOW);
digitalWrite(greenLed, LOW);
digitalWrite(blueLed, LOW);
lcd.clear();
lcd.print("NORMAL");
}

delay(2000); // Aguarda 2 segundos antes de fazer a próxima leitura
}

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Do you have a question ?

You have...

You classify the following as "NORMAL" but they are very different.

(temperature > 24 && temperature <= 40)
.
(temperature >= 17 && < 18)

Sorry I cannot read your gibberish, use code tags when posting code then we all can read it. I am curious, why did you post this, I do not see a question to try to answer.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.