Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fce64f7

Browse files
authoredJun 13, 2023
Update KeyboardReprogram.ino
Adds <buttonPin> to keep code standard
1 parent 2efb50e commit fce64f7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎libraries/USB/examples/Keyboard/KeyboardReprogram/KeyboardReprogram.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ void loop(){}
3434
#include "USBHIDKeyboard.h"
3535
USBHIDKeyboard Keyboard;
3636

37+
const int buttonPin = 0; // input pin for pushbutton
38+
3739
// use this option for OSX.
3840
// Comment it out if using Windows or Linux:
3941
char ctrlKey = KEY_LEFT_GUI;
@@ -45,14 +47,14 @@ char ctrlKey = KEY_LEFT_GUI;
4547
void setup() {
4648
// make pin 0 an input and turn on the pull-up resistor so it goes high unless
4749
// connected to ground:
48-
pinMode(0, INPUT_PULLUP);
50+
pinMode(buttonPin, INPUT_PULLUP);
4951
// initialize control over the keyboard:
5052
Keyboard.begin();
5153
USB.begin();
5254
}
5355

5456
void loop() {
55-
while (digitalRead(0) == HIGH) {
57+
while (digitalRead(buttonPin) == HIGH) {
5658
// do nothing until pin 0 goes low
5759
delay(500);
5860
}

0 commit comments

Comments
 (0)
Please sign in to comment.