The onboard library to turn the target into a USB keyboard works for keys, but not for LEDs.
There are patches for the standard library for IDE 1.8 to fix that, but that's a bit backward by now...
Any recommendations what library/package one would need to turn a RPi Pico into a keyboard with shift lock/scroll lock/num lock/compose/kata/etc. LEDs?
Hi @treczoks_job. Are you asking for a way to control the LEDs? If so, you can emulate keypresses of the associated keys.
You can use these macros:
KEY_CAPS_LOCK
KEY_SCROLL_LOCK
KEY_NUM_LOCK
Or are you asking for a way to read the state of the LEDs? If so, I think the library recommended by @sterretje will be a good option, but you might also like to know that the addition of such a capability to the Keyboard library has been proposed:
If you have a GitHub account, you can subscribe to those threads to get notifications of any new developments related to this subject:
Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.
I had a quick look at the Github Page and the Wiki, and it seems like it does not support the target platform (RPi Pico) - in fact, it explicitely says "no ARM support". So it's not a solution for this.
They are one and the same. The only breaking change to the libraries format was the introduction of the "1.5" format that is supported by Arduino IDE >=1.5.x, but not by <=1.0.x.
However, I didn't take enough care you understand the nature of your question. I just saw "standard library" and jumped to the conclusion we were talking about the official "Keyboard" library. If I had been more careful I would have understood that a different library is used for the Pico board. If you are using the "Raspberry Pi Pico/RP2040/RP2350" boards platform from Earle F. Philhower, III, then it is a variant of that library:
or if you are instead using the "Arduino Mbed OS RP2040 Boards" platform, then it would likely be this one:
So what I wrote is not relevant and the information provided by @customcontroller is the useful assistance.
Thank you for your concise answer. It is good to know that the switch from 1.8 to 2.x didn't change much with regards to the libraries, that is important knowledge to stow away for the future.
I am using the " earlephilhower/arduino-pico libraries, and while they do have a function to "install" a callback with OnLED( function, userdata ), there seems to be no actual calling mechanism anywhere in the code for that callback.
I'll check the Adafruit TinyUSB library ASAP.
Just out of curiosity: Is there a reason why this callback for the LED status is implemented neither in the official libraries nor in the Earle Philhower ones?
FYI, we use a fork of the standard Arduino library because Keyboard is a HID device and we can use its logic with USB, Bluetooth, and BLE with only minor changes. So we abstract out the transport from the HID packet processing. BT and BLE send the same HID packets as USB devices, just over a different low level transport. Same goes for the Mouse and Joystick...USB==BT==BLE.
When I wrote those docs 4 years ago, that was the correct link. But Arduino has obviously redone their website since. Feel free to submit a PR on GitHub (you can even do the edits through the website and submit without ever using git on your own system).
I would suggest doing both. It is good to report it to Arduino so that the website maintainers can set up a redirect from the old URL to the new URL to cause the many links to the old URL that may exist across the Internet to continue to work.
However, even after a redirect is in place, it is still best to update links to point to the new URL instead of relying on the redirect, as there is no guarantee that the redirect will continue to work into the future. What sometimes happens is that the content is moved yet again (the Arduino website is in a state of perpetual churn), and even though a redirect is set up from the old URL to the new URL at that time, for some reason or other the redirect from the old old URL doesn't resolve to the new URL.
404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: reference/tr/language/functions/communication/serial/readstringuntil
RequestId: XZ6VCH78QZHJWAS9
HostId: wSvEq2iHOqKR5OL6M3PXhiSglX2sRnk3/AG5L6deJXy6NeeI5J08kAA0CBQ13JnAAr1Vsl7pAOg=
I'll put a note in the contact form, but I have no idea if that's actually monitored by anyone who can do anything about it...