Hello again everyone!
I've been doing a bit of reading and I've tried a couple of things but can't seem to get properly started.

My end goal is to be able to press capslock (or emulate a capslock press) on the host device and have that sent directly to the Espruino Pico which I've got in USB HID mode. I'd like for the Espruino to then be able to be recognise that command and then I'd activate a function to turn on one of its LEDs. Then behave as one would expect and adjust all characters sent to the host as if the Caps Lock were pressed on an actual keyboard.

My understanding is that commands like setleds can be used to manipulate the LEDs on Keyboards and I this would be a cool way to do it but I'm unsure how to get the Espruino to receive/understand this.

I'm very keen to avoid writing a script that would simply sends one of the echo commands to the espruino upon a capslock press. Though I would not mind writing a script that realises a caps Lock has been pressed and sends a setleds command.

TLDR: How do I get the Espruino Pico to understand a setleds/Caps Lock command from the host as if it were a real Keyboard?

I'm afraid there's no way to do that at the moment. Espruino's USB HID uses only one USB endpoint (running from the Espruino to the PC), so there's only ever one-directional data transfer.

Having said that, you may not need it depending on what you're planning. As far as I know, keyboards send the key that's pressed - but for instance that would just be the 'A' key - there's no understanding of what is upper and lower case. That is handled by the PC.

If you press 'shift-A' it sends 'A' but with a 'shift' modifier. Caps lock doesn't have any effect on what is sent back.

Post a reply

Bold

Italics

Link

Image

List

Quote

code

Preview

Formatting Help

Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.

Tips:

Create headers by underlining text with ==== or ----

To *italicise* text put one asterisk each side of the word

To **bold** text put two asterisks each side of the word

Embed images by entering: ![](https://www.google.co.uk/images/srpr/logo4w.png)That's the hard one: exclamation, square brackets and then the URL to the image in brackets.

* Create lists by starting lines with asterisks

1. Create numbered lists by starting lines with a number and a dot

> Quote text by starting lines with >

Mention another user by @username

For syntax highlighting, surround the code block with three backticks:

```
Your code goes here
```
Just like Github, a blank line must precede a code block.

If you upload more than 5 files we will display all attachments as thumbnails.