Here is the source code for a simple Arduino-based sequencer and tone generator. I used this code to check-out and test the littleBits Arduino module as a note sequencer and tone generator (square wave oscillator).
The sketch uses the Arduino tone()
function for tone generation. Thus, the tuning is not super-precise and the sound of pure square waves is quite harsh. If you run this sketch on the littleBits Arduino, you can take some of the edge off the square waves by putting the physical pin mode switch into the “analog” position. This position enables low pass filtering on the output pin.
ToneTest.ino: Main sketch
ToneFreq.h: Note frequencies
ToneNote.h: Note durations