Countdown to Christmas Makes Challenge 2017 – Day 9

Rudolph the Red Nosed Reindeer

For the BBC micro:bit

Programed in MicroPython

A fun little part rendition of “Rudolph the Red Nosed Reindeer” song for the BBC micro:bit, coded in MicroPython.

To start the music, just press the A button on your BBC micro:bit and it will play once. To play again, just press the button once more. If you would like the music to play continuously just remove or comment out line 18; if button_a.is_pressed():.

For details on how to connect headphones to your BBC micro:bit, check out Day 1 of my Countdown to Christmas Makes Challenge 2017.

MicroPython Code

# Rudolph the Red Nosed Reindeer
# @KariLawler (Twitter), 09/Dec/17, v1.1 10/Dec/17
from microbit import *
import music

rudolph_the_red_nosed = ['g4:2', 'a:4', 'g:2', 'e:4', 'c5:4']
rein_deer = ['a4:4', 'g:12']
had_a_very_shiny = ['g:2', 'a:2', 'g:2', 'a:2', 'g:4', 'c5:4']
nose = ['b4:8', 'r:8']
and_if_you_ever = ['f:2', 'g:4', 'f:2', 'd3:4', 'b4:4']
saw_it = ['a:4', 'g:12']
you_would_even_say_it = ['g:2', 'a:2', 'g:2', 'a:2', 'g:4', 'a:4']
glows = ['e:8', 'r:8']

# ticks = 4 (default), bpm = 140
music.set_tempo(bpm = 140)
while True:
    if button_a.is_pressed():
        music.play(rudolph_the_red_nosed)
        music.play(rein_deer)
        music.play(had_a_very_shiny)  
        music.play(nose)      
        music.play(and_if_you_ever)
        music.play(saw_it)
        music.play(you_would_even_say_it)
        music.play(glows)

Leave a Reply