~xdavidwu/motion-control

51ded228e0e99c28229e01e7c43a72d89a7de1c6 — xdavidwu 2 years ago a2437b9
add buttons reader for micro:bit

to be used with buttonc
1 files changed, 13 insertions(+), 0 deletions(-)

A microbit/buttons.py
A microbit/buttons.py => microbit/buttons.py +13 -0
@@ 0,0 1,13 @@
from microbit import *

a = False
b = False
while True:
    ap = button_a.is_pressed()
    bp = button_b.is_pressed()
    if a != ap:
        a = ap
        print('A' if ap else 'a', end='')
    if b != bp:
        b = bp
        print('B' if bp else 'b', end='')