]> mj.ucw.cz Git - home-hw.git/commitdiff
Waiting room: WIP
authorMartin Mares <mj@ucw.cz>
Sat, 19 Apr 2025 19:34:46 +0000 (21:34 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 19 Apr 2025 19:34:46 +0000 (21:34 +0200)
waiting/microbit/main.py

index 4c3a9426b648f9b78567c7099180183d0f87600a..46b20c06a65bd846a21469f14df2767f3e8ac270 100644 (file)
@@ -12,11 +12,21 @@ wk = Wukong.WUKONG()
 wk.set_light(10)
 wk.set_motors(1, 0)
 
+def gate_open():
+    display.show(Image.HEART)
+    wk.set_servo(0, 90 // 2)
+    np[1] = (15, 0, 0)
+    np.show()
+
+def gate_close():
+    display.show(Image.HAPPY)
+    wk.set_servo(0, 0)
+    np[1] = (0, 0, 0)
+    np.show()
+
 while True:
     if button_a.is_pressed():
-        display.show(Image.SAD)
-        wk.set_servo(0, 90 // 2)
+        gate_open()
     if button_b.is_pressed():
-        display.show(Image.HAPPY)
-        wk.set_servo(0, 0)
+        gate_close()
     sleep(100)