int sensor= A2;
int sensorLecture= 0;
int LED= D7;
int a=0;
int b=0;
void setup() {
Serial.begin (9600);
pinMode(sensor, INPUT);
pinMode(LED, OUTPUT);
}
void loop() {
sensorLecture=digitalRead(sensor);
if (sensorLecture == HIGH)
{
a=a+1;
b=0;
delay (200);
}
if (a == 1 && b == 0)
{
digitalWrite(LED, HIGH);
Serial.println("ON");
b=1;
}
if (a == 2)
{
digitalWrite(LED, LOW);
Serial.println("OFF");
a=0;
}
}
A R D U I N O