Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions libraries/USBHID/examples/Keyboard/Keyboard.ino
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
/**************************************************************
** Brief introduction to a few HID Keyboard commands. **
** Unlike the other Keyboard library, this one doesn't use **
** the "press", "release", and "send" commands. **
**************************************************************/

#include "PluggableUSBHID.h"
#include "USBKeyboard.h"

USBKeyboard Keyboard;

void setup() {
// put your setup code here, to run once:
// Arbitrary pin.
const int CONTROL_PIN = 2;

void setup() {
// We will use this to start/end the prints.
pinMode(CONTROL_PIN, INPUT_PULLUP);
}

void loop() {
// put your main code here, to run repeatedly:
delay(1000);
Keyboard.printf("Hello world\n\r");
// This will run only if the control pin is connected to ground.
if( digitalRead(CONTROL_PIN) == LOW){
delay(1000);
Keyboard.printf("Hello world\n\r");
}
}