const int sensor = 13;
int valor = 0;
int estado = LOW;
const int rele = 12;
void setup() {
pinMode(sensor, INPUT);
pinMode(rele, OUTPUT);
Serial.begin(9600);
}
void loop() {
valor = digitalRead(sensor);
if(valor == HIGH){
Serial.println(valor);
digitalWrite(rele, HIGH);
delay(500);
}else{
digitalWrite(rele,LOW);
}
}