Digikeyboard with LEDs

danjovicdanjovic wrote 03/08/2020 at 20:25 • 1 min read • Like

I have just added support for LED status on Digispark Keyboard library.

Now to get the LED status is just a matter of calling the function



and test for one of the 3 contants:




Just like in the example

// USB Caps Lock Led gizmo - Danjovic 2020
// Use modified version of DigiKeyboard library
#include "DigiKeyboard.h"

void setup() {
  pinMode(1,OUTPUT);      // Digistump BuiltIn LED as output

void loop() {
  // Check the state of Caps Lock and change led accordingly
  if (DigiKeyboard.getLEDs() & CAPS_LOCK)
      digitalWrite(1, HIGH);
      digitalWrite(1, LOW);

The modified version of the libraries are available at:

It is necessary to get the 3 files below...

The latter file enhances the keystroke definition of the original project and defines full set of HID Keycodes (from 0x00 to 0xE7).

.. and copy the files to the following path



danjovic wrote 08/28/2020 at 18:01 point

No problem, I am glad that it worked!

  Are you sure? yes | no

danjovic wrote 08/28/2020 at 15:33 point

You welcome!

I will take a look. Have a question:i did it worked on previous version?

  Are you sure? yes | no

Dadwarf wrote 08/28/2020 at 17:07 point

In fact i removed my question because i found my problem : USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH as to be set to 63 in usbconfig.h .. and it works. But thanks agfain that's nice ! 

  Are you sure? yes | no

Dadwarf wrote 08/28/2020 at 17:08 point

(I should had removed only my question not my praised)

  Are you sure? yes | no