I have finally found some time to act on my long-standing goal to learn how to program microcontrollers. It's all rather pointless, though, if you cannot make them interact with the surrounding world in some interesting ways. This, in turn, involves quite a bit of analog electronics, which I haven't done all that much. There's a bunch of good materials all over the Internet that can help. I find this one particularly useful. It goes step-by-step through all the basics, as well as op-amps and transistors. The coolest part of it is that you can use what you learn immediately. The microcontroller part is rather rudimentary, so I made the robot play RTTTL ringtones. RTTTL is the same format that Nokia used for their old phones and there is plenty of tunes floating all around the Internet. I used this code as a base and ported it to Energia.
I like MSP-430 because, after programming it, you can remove it from the development kit and solder onto your board.
This is how the robot works:
- It plays Scott Joplin's "The Entertainer" tune.
- It waits for a noise command to enable the light-following.
- It acknowledges the command.
- It follows the light.
- If it detects no light, it waits for another noise command to leave the following mode.