code.py
 1  # SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import usb_hid
 6  from adafruit_circuitplayground.express import cpx
 7  from adafruit_hid.keyboard import Keyboard
 8  from adafruit_hid.keycode import Keycode
 9  
10  kbd = Keyboard(usb_hid.devices)
11  
12  while True:
13      if cpx.button_a:
14          kbd.send(Keycode.SHIFT, Keycode.A)  # Type capital 'A'
15          while cpx.button_a: # Wait for button to be released
16              pass
17  
18      if cpx.button_b:
19          kbd.send(Keycode.CONTROL, Keycode.X)  # control-X key
20          while cpx.button_b: # Wait for button to be released
21              pass