From 652e590e235ec86eb6b0c47e29c1f7778aed7b16 Mon Sep 17 00:00:00 2001 From: NicoHood Date: Sat, 10 Oct 2015 12:27:30 +0200 Subject: [PATCH] updated Led Example --- examples/KeyboardLed/KeyboardLed.ino | 15 ++++----------- keywords.txt | 2 ++ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/examples/KeyboardLed/KeyboardLed.ino b/examples/KeyboardLed/KeyboardLed.ino index 06b6d4c..88df32e 100644 --- a/examples/KeyboardLed/KeyboardLed.ino +++ b/examples/KeyboardLed/KeyboardLed.ino @@ -6,19 +6,12 @@ Press a button to toogle caps lock. Caps lock state is represented by the onboard led. + Leds are only supported on single report HID devices. See HID Project documentation for more information. https://github.com/NicoHood/HID/wiki/Keyboard-API */ -// Choose your favourite keyboard -#define USBKEYBOARD Keyboard - -//#define USBKEYBOARD NKROKeyboard - -//#define USBKEYBOARD TeensyKeyboard -//#define USE_TEENSY_KEYBOARD - #include "HID-Project.h" const int pinLed = LED_BUILTIN; @@ -29,21 +22,21 @@ void setup() { pinMode(pinButton, INPUT_PULLUP); // Sends a clean report to the host. This is important on any Arduino type. - USBKEYBOARD.begin(); + BootKeyboard.begin(); } void loop() { // Update Led equal to the caps lock state. // Keep in mind that on a 16u2 and Arduino Micro HIGH and LOW for TX/RX Leds are inverted. - if (USBKEYBOARD.getLeds() & LED_CAPS_LOCK) + if (BootKeyboard.getLeds() & LED_CAPS_LOCK) digitalWrite(pinLed, HIGH); else digitalWrite(pinLed, LOW); // Trigger caps lock manually via button if (!digitalRead(pinButton)) { - USBKEYBOARD.write(KEY_CAPS_LOCK); + BootKeyboard.write(KEY_CAPS_LOCK); // Simple debounce delay(300); diff --git a/keywords.txt b/keywords.txt index 41c5112..805d1a4 100644 --- a/keywords.txt +++ b/keywords.txt @@ -60,6 +60,8 @@ USBDevice KEYWORD1 HID KEYWORD1 Keyboard KEYWORD1 Mouse KEYWORD1 +BootKeyboard KEYWORD1 +BootMouse KEYWORD1 RawHID KEYWORD1 System KEYWORD1 Consumer KEYWORD1