Countdown to Christmas Makes Challenge 2017 – Day 1

Project:

Jingle Bells

Parts required:

1 x BBC micro:bit
2 x Crocodile (alligator) test leads
1 x Headphones
1 x Power source, either USB or battery

Instructions:

Connect the first crocodile clip to the GND pin and the second crocodile clip to the 0 pin.

Next connect the other clip on the crocodile lead that is connected to the GND pin to base of your headphone jack. Then connect, using the remaining clip on the crocodile lead that is connected to the 0 pin to the tip of your headphone jack.

Note: Be mindful, the sound from your headphones can be quite loud. So be careful before placing by your ear.

Now it time to upload the code to your micro:bit.

Written in MicroPython.

# Jingle Bells by @KariLawler (Twitter), 01/Dec/17, v1.0
from microbit import *
import music

jingle_bells = ['e:2', 'e', 'e:4']
jingle_all_the = ['e:2', 'g', 'c', 'd']
way = ['e:8']
oh_what_fun_it = ['f:2', 'f', 'f:3', 'f:1']
is_to_ride_in_a = ['f:2', 'e', 'e', 'e']
one_horse_open = ['e:2', 'd', 'd', 'e']
sleigh = ['d:4', 'g']

while True:
    music.set_tempo(bpm=110)
    music.play(jingle_bells)
    music.play(jingle_bells)
    music.play(jingle_all_the)
    music.play(way)
    music.play(oh_what_fun_it)
    music.play(is_to_ride_in_a)
    music.play(one_horse_open)
    music.play(sleigh)

Bonus:

Code block version

https://makecode.microbit.org/_EzWAzTV9DAjw

Leave a Reply