boolean alert = LOW;
int lasttemp = 0;
void setup() {
pinMode(A0 , INPUT);
Serial.begin(115200);
}
void loop() {
int x = analogRead(A0);
float y = x * 5.0 / 1023 ;
int z = (y * 100) - 50;
if(z != lasttemp){
lasttemp = z ;
Serial.println(lasttemp);
}
if(z >= 60){
alert = HIGH;
}
if(alert){
if(z <= 45){alert = LOW;}
}
digitalWrite(2, alert);
digitalWrite(13,alert);
}