An Arduino Gift Box
What do you get for the friend who has been a software coder since leaving Uni, but used to play with hardware? An Arduino gift selection of course!
The motivation behind this project was to create something to get a friendly software developer back into hardware. It should include some useful components (LEDs, resistors, piezo squeaker, buttons), but also use them in some way and provide simple sample code showing how to interface to them all.
I’ll have to put up a schematic at some point, but you should be able to figure it all out from the picture below and the sketch code.
Big chunks of the code are lifted straight from the Arduino examples, and I’m not claiming that any of this is elegant or neat, but it does meet my specification. 🙂
Basically we have a box which plays simple tunes. It has 3 buttons: Up, down and enter. The 7-segment LED display tells the user what number tune they have selected, and pressing enter plays it.
This program has 3 short tunes embedded in it, and pressing the buttons to select a number above 3 or below 1 has no effect.
When the first tune is playing, the arduino sends the lyrics back to the host computer (if connected) through the serial port. These lyrics are stored in program memory (to save precious RAM).
You’ll also notice I’ve peppered the code with debug output – these can be enabled by uncommenting the #define DEBUG on line 11.
Here’s the sketch.
Here’s a short video of it in action: