New answers tagged

0

You are overcomplicating the program. There is no point in remembering when each of the notes started. You just have to remember: what note is currently playing when you started playing this note Then the logic of loop() becomes simply: “if we are done with the current note, then start playing the next one.” In code: Edit: Changed the code to include your ...


0

Your code falls through (skips over) the first “if” statement in the output code because its time period has not yet passed. It then starts to use startMillis_2, which is not yet initialized (and may be any value), in the next “if”. Initialization of startMillis_2 only happens inside the first “if” statement but that code has not yet been executed. The ...


0

Thanks to Edgar's answer and Nebsie's explaination on how the counter exactly works I could come up with my own implementation of how to rectify delay and micros() that - so far - seems to work fine on my Arduino Uno. I'm not saying that this is the most precise implementation, especially I have my doubts on micros() if for example an timer overflow occours ...


Top 50 recent answers are included