hello
i have a problem on my program, what i want is when i press the button the if statement execute then after 10 seconds the else if statement execute but before the 10 seconds time when i repress the button, if statement execute then the timer count again 10sec.
thanks
sample video that i want when he didn't trigger the sensor after a few sencond the lights off :))
my program
void loop() {
if(digitalRead(switchPin) == HIGH && button == 0){ /* if D2 is HIGH /
delay(200); / Soft Debounce delay for 500mS */
button = 1;
//sound
send(0x0001);//play file 0000
delay(100);//delay 10 seconds
send(0xfff7);//set voice volumn to 7
delay(300);
//light
pew();
send(0xfffe);// pause
}
else if(digitalRead(switchPin) == LOW && button == 1){
button = 0;
pewew();
}
}