From cf5fc143ac8fb2d54295101879554c96203e751d Mon Sep 17 00:00:00 2001 From: Scott Fitzgerald Date: Sat, 3 May 2014 19:16:29 +0400 Subject: [PATCH] Modified Keyboard Reprogram example Updated to reflect changes with how the IDE creates new blank sketches. --- .../KeyboardReprogram/KeyboardReprogram.ino | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino b/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino index 17cb04d7b..08e47479b 100644 --- a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino +++ b/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino @@ -11,12 +11,14 @@ a final key combination (CTRL-U). Circuit: - * Arduino Leonardo or Micro + * Arduino Leonardo, Micro, Due, LilyPad USB, or Yun * wire to connect D2 to ground. created 5 Mar 2012 modified 29 Mar 2012 by Tom Igoe + modified 3 May 2014 + by Scott Fitzgerald This example is in the public domain @@ -54,6 +56,18 @@ void loop() { // wait for new window to open: delay(1000); + // versions of the Arduino IDE after 1.5 pre-populate + // new sketches with setup() and loop() functions + // let's clear the window before typing anything new + // select all + Keyboard.press(ctrlKey); + Keyboard.press('a'); + delay(500); + Keyboard.releaseAll(); + // delete the selected text + Keyboard.write(KEY_BACKSPACE); + delay(500); + // Type out "blink": Keyboard.println("void setup() {"); Keyboard.println("pinMode(13, OUTPUT);"); @@ -93,3 +107,4 @@ void loop() { +