File tree 1 file changed +16
-5
lines changed
libraries/USBHID/examples/Keyboard
1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change
1
+ /* *************************************************************
2
+ ** Brief introduction to a few HID Keyboard commands. **
3
+ ** Unlike the other Keyboard library, this one doesn't use **
4
+ ** the "press", "release", and "send" commands. **
5
+ **************************************************************/
6
+
1
7
#include " PluggableUSBHID.h"
2
8
#include " USBKeyboard.h"
3
9
4
10
USBKeyboard Keyboard;
5
11
6
- void setup () {
7
- // put your setup code here, to run once:
12
+ // Arbitrary pin.
13
+ const int CONTROL_PIN = 2 ;
8
14
15
+ void setup () {
16
+ // We will use this to start/end the prints.
17
+ pinMode (CONTROL_PIN, INPUT_PULLUP);
9
18
}
10
19
11
20
void loop () {
12
- // put your main code here, to run repeatedly:
13
- delay (1000 );
14
- Keyboard.printf (" Hello world\n\r " );
21
+ // This will run only if the control pin is connected to ground.
22
+ if ( digitalRead (CONTROL_PIN) == LOW){
23
+ delay (1000 );
24
+ Keyboard.printf (" Hello world\n\r " );
25
+ }
15
26
}
You can’t perform that action at this time.
0 commit comments