int rele = 8;
void setup() {
pinMode(rele, OUTPUT);
Serial.begin(9600);
}
void loop() {
int holat = map(analogRead(A0), 0, 1023, 0, 100);
Serial.println(holat);
if (holat >= 50) {
digitalWrite(rele, HIGH);
tone(5, 400);
} else {
digitalWrite(rele, LOW);
noTone(5);
}
}