const int Bot = 10;
int contador = 0;
void setup() {
// put your setup code here, to run once:
pinMode(12, OUTPUT);
pinMode(Bot, INPUT_PULLUP);
Serial.begin(9600);
delay(1000);
}
void loop() {
// put your main code here, to run repeatedly:
if (!digitalRead(Bot)){
contador++;
if (contador == 1){
digitalWrite(12, HIGH);
Serial.println("Ligado");
delay(1000);
}
}
if (!digitalRead(Bot)){
contador--;
if (contador == 0){
digitalWrite(12, LOW);
Serial.println("desligado");
delay(1000);}
}
}