Search code examples
audiotimerarduino

Playing multiple continuous tones on Arduino


I am working on a project for college. It involves an Arduino Pro Trinket, and is supposed to be an instrument of some kind.

The premise is that you will have 4 potentiometers which will change the pitch of 4 tones. These tones will be enabled/disabled by one button each. The tones can be played on any number of piezos, however the less the better.

I'm aware that Arduinos do not have sufficient timers to play multiple tones, however in my case, timers are not necessary.

I'm pretty much brand new to Arduino; I do, however, get the basics of using potentiometers with them which is the only other difficult part.

Am I complicating this?


Solution

  • The Arduino Pro Trinket uses an Atmega328P processor, which has three timers with two outputs per timer. One timer is used by the core, which leaves enough outputs for your application.

    If you want to play concurrent tones on different pins, using the timers is probably the easiest way to go, but you can roll your own algorithm, and there are libraries available for this as well.