Skip to content

User friendliness #548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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");
}
}