The assignment for this week was to modify the hello echo board by adding a button and modifying its software to respond to button presses.

Making a button-controlled light with an AVR chip was easy once I understood that I had to set the input pin for the switch with set_A(pin) and the output for the LED with output_A(pin). I was using avr-libc, avr-gcc, avr-binutils and avrdude, which I installed on my Mac OS X Leopard laptop with the help of MacPorts. Anyone who has used Debian or Ubuntu's dpkg and apt can appreciate how great it is to have a package manager like MacPorts. I installed MacPorts and then ran each of the following commands on the Terminal to install the necessary software to develop for AVR chips:

% sudo port install avr-libc
% sudo port install avr-gcc
% sudo port install avr-binutils

That's all. Here are some images of my work in progress:

Once I got the basic light on-off working, I started work on a more complex board. The idea was to create a system that could record basic rhythms. Here's a video of the work in progress.

Below is the final work. The red LED acts as a metronome. Pressing the left button puts the board into record mode (with the metronome beating faster). Then, pressing the right button records a note as a green LED, which then loops and plays back.

Pressing the record key again moves the input to the next green LED. In all, the board supports four simultaneous tracks of silent music.

The next step in this project would be to create an output system. I would love to see a set of servo motors connect to the output so that the rhythms could be bashed out on any object. The bigger the better.

View source code.