Adafruit_Learning_System_Gu.../Make_It_A_Keyboard/keycodes.py
Limor "Ladyada" Fried 42e4c7a214
Update keycodes.py
2018-08-01 12:01:51 -04:00

16 lines
490 B
Python

from adafruit_circuitplayground.express import cpx
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
kbd = Keyboard()
while True:
if cpx.button_a:
kbd.send(Keycode.SHIFT, Keycode.A) # Type capital 'A'
while cpx.button_a: # Wait for button to be released
pass
if cpx.button_b:
kbd.send(Keycode.CONTROL, Keycode.X) # control-X key
while cpx.button_b: # Wait for button to be released
pass