CrudBox: Finished (for now)!!!1
Complete Arduino code here.
I've built all the functionality I want for this semester for the CrudBox (I plan on continuing with it for NIME and likely beyond). Check out the video.
It can now remember 4 different loops. You can see which one you're one on the 7 segment display and scroll to different ones with the rotary encoder knob next to it. The tempo can now be seen on the 4 LEDs in the lower right corner.
To reiterate how it works:
There are 4 speaker terminals on the box, into each of which you can plug any object that can run on 5 volts. In the video I've plugged in LEDs because it makes the interaction clearer, but my main interest is in plugging motors in, attaching them to the box, and amplifying the sounds they make. Each speaker terminal has a button and a pot. Pay attention to which of the 4 tempo LEDs is on, then press a button, then let go. It will switch on the object (motor, LED, etc), then switch it off when you let go. The next time it cycles through the loop of 4 LEDs it will switch on and off at the same points. The object will pulsewidth modulate at different speeds depending on what position the pot is in when you switched it on. You can do this up to 8 times and can change the PWM with each one, then do the same with the 3 other objects.
Whatever number is currently displayed on the 7seg display is the number of the loop you've created. Turn the rotary encoder and the number will change, and you can do what you just did with this new loop. The 7segment display shows numbers 1-4, so you can record 4 different loops.
The code above uses 1 MC14067BCP analog multiplexer for all the switches and knobs for the 4 objects. The rotary encoder and the erase button use digital pins directly on the Arduino. The output is two 74HC595 shift registers in sequence, one for the 7segment display and one for the objects output.