← index #7241PR #892
Off-topic · high · value 1.945
QUERY · ISSUE

How do I read USB keyboard input in Pi Pico

openby nayanaggopened 2021-05-10updated 2025-10-03
port-rp2

Hi,

I've attached OTG to MicroUSB of pi pico to connect the USB keyboard and power the pico with VBUS 5V.

the issue is how can I read the input in Pi Pico using i2cLCD.

CANDIDATE · PULL REQUEST

usb/usb-device-keyboard: Add key release.

openby amogha1234opened 2024-07-04updated 2024-07-05

Micropython 1.23 preview version is used with Raspberry pi pico w board.
Trying to send keys using usb-keyboard library. It was clicking the key, but not releasing it, similar to #873 . Resulting in continuous sending key.
Hence added release_all() function, which releases all keys. And it worked with Rpi pico w.

2 comments
dpgeorge · 2024-07-04

You should be able to release all keys by calling keyboard.send_keys(()), ie pass an empty tuple (or empty list [] but an empty tuple is more efficient because it doesn't allocate memory).

amogha1234 · 2024-07-05

You should be able to release all keys by calling keyboard.send_keys(()), ie pass an empty tuple (or empty list [] but an empty tuple is more efficient because it doesn't allocate memory).

Thank you,
I thought it is better to have a dedicated function to release keys as it is present in other keyboard libraries of circuit-python and Arduino, it will be useful for the users.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied