Hi guys,
Does anyone know how I'd go about having different buttons play a different tone through a speaker?
I'm thinking of using this method, but I don't know how to create tones using the buttons.
https://www.arduino.cc/en/Tutorial/toneMelody
Any advice would be appreciated!
Do you know how to make buttons work without using delay()?
Why no delay() is so that when you press or release a button during a delay() it will not be noticed right then.
An introduction to the subject of How to do multiple things at once can be found here:
Yes it deals with blinking leds and doesn't answer your questions directly but it does teach a fundamental lesson that will let your sketch watch buttons and play tones in response to button inputs in real time. Call it walk instead of crawl, we all start out crawling and those first steps do take a lot of effort.
Try my sketch here, written for as 1284P, but you could easily edit it to work with fewer notes on a 328P.
Schematic, code, even a youtube video showing 8 notes playing at once. (Ran out of buttons to show 13, a whole octave).
http://forum.arduino.cc/index.php?topic=179761.0