float temp;
void setup() {
pinMode(28, INPUT);
pinMode(27, OUTPUT);
}
void loop() {
temp = analogRead(28);
temp = (temp * 5.0 * 33.333) / 1024.0;
// Check if temperature is less than 20
if (temp < 20) {
digitalWrite(27, LOW);
}
// Check if temperature is between 20 and 40
else if (temp >= 20 && temp < 100) {
digitalWrite(27, HIGH);
}
}