Adafruit_Learning_System_Gu.../Make_It_A_Keyboard/strings/code.py
2022-02-18 16:51:56 -05:00

18 lines
506 B
Python

# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import usb_hid
from adafruit_circuitplayground.express import cpx
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(kbd)
while True:
if cpx.button_a:
# Type 'Jane Doe' followed by Enter (a newline).
layout.write('Jane Doe\n')
while cpx.button_a:
pass