/* jquery */ /* jquery accordion style*/ /* jquery init */

Countdown Timer (micro:bit MicroPython)

Type in the following code to create a three second timer.

from microbit import *

display.show('3')
sleep(1000)
display.show('2')
sleep(1000)
display.show('1')
sleep(1000)
display.show('0')

Notice we put quotes around the countdown numbers so they appear as strings to the display.show() function.

After you've downloaded and run this program on the micro:bit have a go at building a 10 second timer.

Return to the BBC micro:bit MicroPython Coding Tutorials page.

No comments: