Avatar for user79809

user79809

Member since Jul 2017 • Last active Aug 2017
  • 2 conversations
  • 5 comments

Most recent activity

  • in Pico / Wifi / Original Espruino
    Avatar for user79809

    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?

  • in Pico / Wifi / Original Espruino
    Avatar for user79809

    I'll have a look into it a bit more and I'll post here if I discover anything

  • in Pico / Wifi / Original Espruino
    Avatar for user79809

    Windows 10 is what I was using. I have switched to ubuntu and now it now works as expected. It's no biggie for me for now that it doesn't seem to like windows 10. Thanks for the help!

  • Avatar for user79809

    Thank you for responding so quickly! My apologies, I didn't explain very clearly. The LED works perfectly all the time. I did use save(). It's just the "HELLO WORLD" part that does nothing, even after unplugging and replugging the pico.

    The Firmware is 1v93

  • Avatar for user79809

    I have sent the following code to the espruino pico and saved:

    var kb = require("USBKeyboard");
    
    setWatch(function() {
      kb.setModifiers(kb.MODIFY.SHIFT, function() {
        kb.type("HELLO WORLD", function() {
          kb.setModifiers(0, function() {
            kb.tap(kb.KEY.ENTER);
            LED2.toggle();
          });
        });
      });
    }, BTN, {debounce:100,repeat:true, edge:"rising"});
    
    

    The LED2.toggle() works perfectly after unplugging and re-plugging but nothing happens when I press the button when I'm expecting "HELLO WORLD". I am fairly new so I apologise if I've simply missed something obvious

Actions