#MonthOfMaking Day 3

#MonthOfMaking Day 3

micromag

March 3, 2019

March is all about MAKING!!

I have decided to take on the challenge of making a 5 minute micro:bit make everyday throughout March.

Day03 – Count Down Timer

Today I have decided to make a countdown timer.

The timer will count up to 20 when button A is pressed and the timer will start counting down from what ever number you chose between 1 and 20 when button B is pressed. Lets get coding!

Python Code

seconds = None
from microbit import *
seconds = 0
while True:
    if button_a.is_pressed:
        if seconds < 20:
            seconds += 1
            display.scroll(seconds)
    if button_b.is_pressed:
        for i in range (seconds):
            display.scroll(seconds)
            sleep(1000)
            seconds -= 1
        display.show(Image.NO)

EduBlocks Code

EduBlocks code

MakeCode Code

MakeCode

Demo

Final Words

Come back Tomorrow for another fun 5 minute micro:bit make