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='')