I programmed 5 Christmas tunes in Arduino, and also made a synchronized light show with some special effects! It plays the following tunes in sequence after each key press:
- Jingle Bells
- The First Noel
- O Holy Night
- We Three Kings
- What Child is This
Here is the source code if you are interested: https://github.com/rmadhuram/ArduinoChristmasTunes
I used these components from the OSEPP ARD-101 “Arduino Basics” kit I picked up at Frys.
- Arduino Uno R3
- R1: 10 K ohms
- R2 – R6: 330 ohms
- LED1, LED5: white, LED2, LED4: green, LED3: red
- J1: Piezzo Buzzer
- S1: Switch
How it Works
The hardware setup is very simple. Lines D3-D7 drives LEDs. D8 drives the Piezzo Buzzer. A switch is connected to D2. We connect resistors before LEDs to limit the current and prevent them from frying.
There are two modes of operation, continuous and button press mode. If we set it to continuous mode, it keeps cycling through all the tunes automatically. The global variable continuousMode should be set to 1 for it to operate on the continuous mode. If it is in button press mode, and we detect a key press, we play the current tune.
We have a global variable toneNum that keeps track of the tune being played. It cycles through 0 to 4. There are also 4 light effects available. We select a random light effect and play it before and after the tune.
– UNDER CONSTRUCTION –