Keyboard input

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
st8728
Posts: 1
Joined: Fri Jan 29, 2021 1:22 pm

Keyboard input

Post by st8728 » Fri Jan 29, 2021 1:31 pm

Hello,

I am new to micropython and just picked up a Raspberry Pi Pico to experiment with. I was trying to create macros to type into the connected device as a HID keyboard. I attempted to use the pyd library with pyd.USB_HID() to send keystrokes with send(), however then realised that this was for a different board altogether.

What options do I have to perform such tasks?

Thank you

Akpa1
Posts: 2
Joined: Sat Jan 30, 2021 3:43 pm

Re: Keyboard input

Post by Akpa1 » Sun Jan 31, 2021 12:19 am

I've got the same question myself.

It's definately possible to do it on the Pico itself, since TinyUSB is mentioned in chapter 2.3.6 of the C/C++ SDK document (https://datasheets.raspberrypi.org/pico ... -c-sdk.pdf). However, looking at the source for the rp2 module (https://github.com/raspberrypi/micropyt ... les/rp2.py), it would appear that there's only stuff for PIO in there. To me (and I may have missed something), it doesn't look like there's an easy way to use USB device mode on the Pico yet without writing C/C++ code. :|

Akpa1
Posts: 2
Joined: Sat Jan 30, 2021 3:43 pm

Re: Keyboard input

Post by Akpa1 » Sun Jan 31, 2021 2:21 pm

I've found a solution involving using Adafruit's CircuitPython instead of MicroPython.

CircuitPython has a beta release for the Pi Pico (https://circuitpython.org/board/raspberry_pi_pico/) that supports usb_hid and Adafruit has a handly library to simplify HID interactions (https://github.com/adafruit/Adafruit_CircuitPython_HID). I've been able to get keyboard inputs working this way.

Image

Post Reply