Hello dear geeks, I'm stuck and need your help!
How can I run LED and Buzzer simultaneously, my current code will run either the LED or the BUZZER FIRST then will carry on with the following line of code
My goal is: Press the button to stop the loop and simultaneously make noise and flash the RED LED
void modeOff() {
digitalWrite(GREEN_LED, LOW); // Switch OFF GREEN LED
digitalWrite(RED_LED, HIGH); // Switch ON RED LED
delay(1000); // Delay for 1 second
digitalWrite(RED_LED, LOW); // Switch OFF RED LED
digitalWrite(GREEN_LED, HIGH); Switch ON GREEN LED
tone(BUZZER, 1350); // Make sound
delay(150);
tone(BUZZER, 950);
delay(150);
tone(BUZZER, 450);
delay(200);
noTone(BUZZER);
}
So far: If the button is pressed loop is stopped, RED LED FLASH and then BUZZ.
How do we run the LED and the BUZZ at the same time?