forked from peconia/MicroBit-Python-Fun
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathawesome_hearts.py
More file actions
32 lines (28 loc) · 721 Bytes
/
awesome_hearts.py
File metadata and controls
32 lines (28 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from microbit import *
def show_image(image):
display.show(image)
sleep(50)
def show_centre_pixel():
display.set_pixel(2, 2, 9)
sleep(50)
def animate_heart():
show_image(Image.HEART)
show_image(Image.HEART_SMALL)
show_centre_pixel()
display.clear()
sleep(50)
show_centre_pixel()
show_image(Image.HEART_SMALL)
show_image(Image.HEART)
sleep(50)
while True:
animate_heart()
if button_a.is_pressed() and button_b.is_pressed():
display.scroll("BYE!")
sleep(1000)
display.clear()
break
elif button_a.is_pressed():
display.scroll("U ROCK!")
elif button_b.is_pressed():
display.scroll("U R AWESOME!")