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
DigiKeyboard.getLEDs()
DigiKeyboard.getLEDs()
and test for one of the 3 contants:
NUM_LOCK
CAPS_LOCK
SCROLL_LOCK
Just like in the example
// USB Caps Lock Led gizmo - Danjovic 2020
// Use modified version of DigiKeyboard library
// https://github.com/Danjovic/DigistumpArduino/tree/master/digistump-avr/libraries/DigisparkKeyboard
#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);
else
digitalWrite(1, LOW);
DigiKeyboard.delay(10);
}
The modified version of the libraries are available at:
https://github.com/Danjovic/DigistumpArduino/tree/master/digistump-avr/libraries/DigisparkKeyboard
It is necessary to get the 3 files below...
- DigiKeyboard.h
- usbconfig.h
- hidkeys.h
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
c:\Users\__name_of_your_user___0\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
No problem, I am glad that it worked!
Are you sure? yes | no
You welcome!
I will take a look. Have a question:i did it worked on previous version?
Are you sure? yes | no
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
(I should had removed only my question not my praised)
Are you sure? yes | no