2022-2023/1NSI/02_Programmation_Python_et_microbit/scripts/05_boutons.py

15 lines
312 B
Python
Raw Normal View History

from microbit import *
import time
while True:
if button_a.is_pressed():
display.show(Image.HAPPY)
time.sleep(1)
display.clear()
elif button_b.is_pressed():
display.show(Image.SAD)
time.sleep(1)
display.clear()
else:
display.show(Image.HEART)