float Temperature = 31;
bool Refrigeration = false;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32-S2!");
}
void loop() {
// put your main code here, to run repeatedly:
Temperature = Temperature + 0.05*(120 - Temperature);
if (Temperature >= 100) {
Refrigeration = true;
} else if (Temperature <= 35) {
Refrigeration = false;
}
if (Refrigeration) {
Temperature = Temperature + 0.25*(17 - Temperature);
}
Serial.print("Temperatura: ");
Serial.println(Temperature);
Serial.println(" ");
Serial.print("Estado de refrigeracion: ");
Serial.println(Refrigeration ? "Encendido" : "Apagado");
delay(1000); // this speeds up the simulation
}
Loading
esp32-s2-devkitm-1
esp32-s2-devkitm-1