recup code pour mu editor

This commit is contained in:
2025-07-05 16:11:20 +02:00
parent 12b8efafbf
commit 5e9ac09dcf
25 changed files with 1006 additions and 0 deletions

25
mu_code/masque.py Normal file
View File

@ -0,0 +1,25 @@
# test choix de picto en fonction de l'orientation
from microbit import *
# creation des images
good_img = Image("50005:90009:09990:00000:00000")
bad_img = Image("00000:00000:09990:90009:50005")
neutral_img = Image("00000:00000:00000:00000:0000")
emotion = "neutral" # neutral / good / bad
# boucle infinie
while True:
# definition de l'humeur a partir de l'accelerometre
z = accelerometer.get_z()
if z < 0:
emotion = "good"
elif z > 400:
emotion = "bad"
# affichage de la derniere humeur enregistree
if emotion == "good":
display.show(good_img)
elif emotion == "bad":
display.show(bad_img)
sleep(200)