Skip to content

Commit cf5fc14

Browse files
committed
Modified Keyboard Reprogram example
Updated to reflect changes with how the IDE creates new blank sketches.
1 parent 3adbeee commit cf5fc14

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino

+16-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
a final key combination (CTRL-U).
1212
1313
Circuit:
14-
* Arduino Leonardo or Micro
14+
* Arduino Leonardo, Micro, Due, LilyPad USB, or Yun
1515
* wire to connect D2 to ground.
1616
1717
created 5 Mar 2012
1818
modified 29 Mar 2012
1919
by Tom Igoe
20+
modified 3 May 2014
21+
by Scott Fitzgerald
2022
2123
This example is in the public domain
2224
@@ -54,6 +56,18 @@ void loop() {
5456
// wait for new window to open:
5557
delay(1000);
5658

59+
// versions of the Arduino IDE after 1.5 pre-populate
60+
// new sketches with setup() and loop() functions
61+
// let's clear the window before typing anything new
62+
// select all
63+
Keyboard.press(ctrlKey);
64+
Keyboard.press('a');
65+
delay(500);
66+
Keyboard.releaseAll();
67+
// delete the selected text
68+
Keyboard.write(KEY_BACKSPACE);
69+
delay(500);
70+
5771
// Type out "blink":
5872
Keyboard.println("void setup() {");
5973
Keyboard.println("pinMode(13, OUTPUT);");
@@ -93,3 +107,4 @@ void loop() {
93107

94108

95109

110+

0 commit comments

Comments
 (0)