I2C
Get just about any kind of I2C breakout and wire it up. Install the appropriate library for your I2C device.
Modify your program so that it turns on the internal LED (pin 13) on and off when you do something interesting, like tilting an accelerometer or heading up a therometer.
If you get a chance, try out the i2c_scanner sketch on your Arduino. This is useful when you are now sure what you have on your board.
The four tasks
The goal is to have all of these working at some point. I have created a Moodle checkoff for this.
LED
Control the brightness of an LED as you move the accelerometer.
Music — sort of
Take a look at the
Play a Melody
using the tone()
function.
(It’s the one we used in CSCI 235 and CSCI 255.)
Also, take a look at the
modification by
Prince (not that once) for playing the Super Mario theme song.
Notice that it suggests putting a 1k Ω resisitor in
series with the Piezzo.
I strongly suggest that you cover the Piezzo with a Post-It
note so that you don’t irritate people with offices near the class
room.
Just play the song once or twice. This is just a test! Do not irritate people in the hall.
Once you have the song playing, take a look at the Adafruit tutorial on making a Theremin. See if you can play your instrument by tilting your board. This will be a small program.
Servos
I found the servos. The are SG90 micro servos, which are used to control little boats. Look them up and try them out. Ignore what I said it class and just run them off the Arduino 5V supply for now.
Soon we will try them out.
Motors
Finally, try out a DC motor. Use a transistor as shown in the transistor/motor lecture.