My level of proficiency with Arduino (and any coding, really) is enough that I can usually copy and paste snippets of existing code, alter it to do what I need, and be on my way. I’m not able to write from scratch as I just can’t wrap my head around it.
This time around I have specific application and I can’t find enough info on it do help me create what I need, so I’m hoping there is someone out there who can help.
My dilemma: I want my arduino board to play a sound. But not just that. I need it to behave in a specific manner, like this:
(nothing happening when switch is off)
(flip switch to ON)
- Play “wind up” sound bite
- Then loop siren sound indefinitely as long as the switch remains ON
(flip switch to OFF)
- Finish the current loop of the siren sound (ex: do not cut it off in the middle)
- Play “wind down” sound bite
- Go Silent until I turn the switch back on
There is an example of what I am trying to accomplish here: https://youtu.be/MaB_mgzgu0g
I know I have to use while loops for this, but I’m not sure how to get it to do one thing, loop another, and then do yet another thing after the looping is broken.