-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.py
More file actions
23 lines (22 loc) · 761 Bytes
/
timer.py
File metadata and controls
23 lines (22 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from microbit import *
while True:
if button_a.is_pressed(): #the loop begins after pressing A
display.clear()
for x in range(0, 5):
for y in range(0, 5):
display.set_pixel(x,y,9)
pin0.write_digital(1) #make a bleep when turning on the leds
pin0.write_digital(0)
sleep(30000) #interval between putting on the leds
display.clear()
sleep(500)
while True:
pin0.write_digital(1)
display.show(Image.HAPPY)
sleep(500)
pin0.write_digital(0)
display.clear()
sleep(500)
if button_b.is_pressed(): #stop the end animation
break
display.clear()