Hi, which is the best way (if any exists!) to use a buzzer and some LEDs at the same time but not at the same frequency?
I mean, I want a procedure to play some "music" with the buzzer while another procedure is playing with LEDs turning them on/off. The music has its own "frequency" with different delays between the notes while the LEDs are turned on or off using other delays independent from the delays between the notes.
Search for my topic "piano tones micros" where I used a Blink without delay style program to allow up to 13 notes to be played. Take the same approach - check the time frequently to see if the next high or low portion of the music tone to be played while doing the same for the LEDs.
Well, my music is not played by switches is the program which plays the notes with appropriate delays. So my program needs to handle different delays between the different procedures.
So, instead of switches, you monitor micros() or millis() and when the time is right you kick off a note, or change the state of a note, or turn a note offk, or on, and the same for an LED.