Countdown to Christmas Makes Challenge 2017 – Day 4

Project:

Countdown to Christmas

Parts required:

1 x BBC micro:bit
1 x Power source, either USB or battery

(Optional to make bauble version)
1 x Clear plastic photo bauble ornament. (7cm / 2-3/4″ wide)
(Bought mine from “The Works” in the UK for £1. Probably find though, in most pound shops or dollar stores)
1 x Kitronik MI:power

Instructions:

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

Tip: If your placing your micro:bit inside a bauble place some crumpled up tissue paper behind it. This will stop it from moving out of place when you shake it.

Just shake to countdown.

Written in MicroPython.

# Countdown to Christmas by @KariLawler (Twitter), 04/Dec/17, v1.0
from microbit import *

days = 25
while True:
    if accelerometer.was_gesture('shake'):
        days -= 1
        if days == 0:
            days = 24
        display.scroll(str(days), wait=False, loop=True)

Leave a Reply