This Python script emulates a USB keyboard using CircuitPython and the Adafruit HID library. It allows automated keystroke input, including typing full strings with customizable delays.
- Emulates a USB keyboard
- Supports typing full strings with adjustable delays
- Supports special character inputs
- Provides a function to press arbitrary key combinations
- A microcontroller board that supports USB HID (e.g., Raspberry Pi Pico, Adafruit Trinket M0, etc.)
- CircuitPython installed on the board
adafruit_hid
library installed
- Install CircuitPython on your microcontroller board.
- Download and copy the
adafruit_hid
library into thelib/
folder on your board. - Save the script as
code.py
on your microcontroller board.
Use the type_string
function to simulate typing a string.
from your_script_name import type_string
type_string("Hello, World!")
Use the key
function to press and release keys with a delay.
from adafruit_hid.keycode import Keycode
from your_script_name import key
key(Keycode.CONTROL, Keycode.C) # Simulates Ctrl+C
type_string("Hello, World!")
This project is licensed under the unlicense.
Pull requests are welcome! Feel free to open an issue if you find a bug or have a feature request.
- Adafruit HID Library
- CircuitPython community