Updated Keyboard examples
This commit is contained in:
parent
1e80589379
commit
2b841bed48
3 changed files with 50 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
|||
Led indicats if we are in bios.
|
||||
|
||||
See HID Project documentation for more information.
|
||||
https://github.com/NicoHood/HID/wiki/Keyboard-API
|
||||
https://github.com/NicoHood/HID/wiki/Keyboard-API#boot-keyboard
|
||||
*/
|
||||
|
||||
#include "HID-Project.h"
|
||||
|
|
|
|||
48
examples/ImprovedKeyboard/ImprovedKeyboard.ino
Normal file
48
examples/ImprovedKeyboard/ImprovedKeyboard.ino
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
Copyright (c) 2014-2015 NicoHood
|
||||
See the readme for credit to other people.
|
||||
|
||||
Improved Keyboard example
|
||||
|
||||
Shows how to use the new Keyboard API.
|
||||
|
||||
See HID Project documentation for more information.
|
||||
https://github.com/NicoHood/HID/wiki/Keyboard-API#improved-keyboard
|
||||
*/
|
||||
|
||||
#include "HID-Project.h"
|
||||
|
||||
const int pinLed = LED_BUILTIN;
|
||||
const int pinButton = 2;
|
||||
|
||||
void setup() {
|
||||
pinMode(pinLed, OUTPUT);
|
||||
pinMode(pinButton, INPUT_PULLUP);
|
||||
|
||||
// Sends a clean report to the host. This is important on any Arduino type.
|
||||
Keyboard.begin();
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
// Trigger caps lock manually via button
|
||||
if (!digitalRead(pinButton)) {
|
||||
digitalWrite(pinLed, HIGH);
|
||||
|
||||
// Use the default print functions
|
||||
Keyboard.println("Hello World!");
|
||||
|
||||
// Press a single character, special non ascii characters wont work.
|
||||
//Keyboard.write('a');
|
||||
|
||||
// Write single keys, do not use a number here!
|
||||
//Keyboard.write(KEY_ENTER);
|
||||
|
||||
// If you really wish to press a RAW keycode without the name use this:
|
||||
//Keyboard.write(KeyboardKeycode(40));
|
||||
|
||||
// Simple debounce
|
||||
delay(300);
|
||||
digitalWrite(pinLed, LOW);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
You may also use SingleNKROKeyboard to enable a single report NKROKeyboard.
|
||||
|
||||
See HID Project documentation for more information.
|
||||
https://github.com/NicoHood/HID/wiki/Keyboard-API
|
||||
https://github.com/NicoHood/HID/wiki/Keyboard-API#nkro-keyboard
|
||||
*/
|
||||
|
||||
#include "HID-Project.h"
|
||||
|
|
|
|||
Loading…
Reference in a new issue