Having got the Pi variant of Andrew Gale’s RGBtree working nicely I thought I would use some spare time over the last couple of days to setup the alternative Micro:bit/codebug version on a Arduino Uno clone, for a bit of fun. Cobbling various bits of Ardunio code together I now have an RGBtree that can will play one of 5 different Christmas songs, when the switch is activated – while running through a random series of colour changes in time with the music. Once the tune has finished playing the Neopixels will continue to change randomly. You can download the code from my Github here. I have also uploaded a quick video to YouTube if you want to see and hear it in action ! .
The music uses quite a lot of the Arduino’s ‘variable’ resources, so I have kept the Neopixel effects simple here. I did not have to make any changes to the RGBtree to get it working with the Arduino, but do be careful if you change from the default brightness settings as the Neopixels can get very bright. The RGB tree is supported on two pins that I was able to position spaced correctly to pickup 5V and GND on the Arduino board. [The Neopixels seem fine working at 5V rather than the labeled 3V.]
I think it is relatively obvious from the code if you want to adapt the code to play different tunes – the size and number of tunes is limited by the ‘variable’ memory size of the Arduino. I guess you could change it to store the tune data in program memory which would greatly extend the storage as an option.