From 5627f14518650ae3fdcc46756957dd4c76b6adf6 Mon Sep 17 00:00:00 2001 From: Tom Igoe Date: Thu, 29 Mar 2012 07:25:22 -0400 Subject: [PATCH 1/3] Fixed typo in the KeyboardReprogram example --- .../Keyboard/KeyboardReprogram/KeyboardReprogram.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino b/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino index 5ee021266..5349da15a 100644 --- a/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino +++ b/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino @@ -15,7 +15,7 @@ * wire to connect D2 to ground. created 5 Mar 2012 - modified 28 Mar 2012 + modified 29 Mar 2012 by Tom Igoe This example is in the public domain @@ -26,7 +26,7 @@ // use this option for OSX: char ctrlKey = KEY_LEFT_GUI; // use this option for Windows and Linux: -// char ctrlKey = KEY_KEFT_CTRL; +// char ctrlKey = KEY_LEFT_CTRL; void setup() { From 7c1b60191b0c453b3ec8f2e6ae790d280a251baf Mon Sep 17 00:00:00 2001 From: Tom Igoe Date: Thu, 29 Mar 2012 12:04:22 -0400 Subject: [PATCH 2/3] Updated comments in keyboard reprogram --- .../Keyboard/KeyboardReprogram/KeyboardReprogram.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino b/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino index 5349da15a..07529bf90 100644 --- a/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino +++ b/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino @@ -23,9 +23,11 @@ http://www.arduino.cc/en/Tutorial/KeyboardReprogram */ -// use this option for OSX: +// use this option for OSX. +// Comment it out if using Windows or Linux: char ctrlKey = KEY_LEFT_GUI; -// use this option for Windows and Linux: +// use this option for Windows and Linux. +// leave commented out if using OSX: // char ctrlKey = KEY_LEFT_CTRL; From 76e551592ab4573aaad19a8aacc3574ce52d4da6 Mon Sep 17 00:00:00 2001 From: Tom Igoe Date: Thu, 29 Mar 2012 15:20:53 -0400 Subject: [PATCH 3/3] Deleted duplicate example --- .../KeyboardAndMouseControl.ino | 94 ------------------- 1 file changed, 94 deletions(-) delete mode 100644 build/shared/examples/9. USB (Leonardo only)/KeyboardAndMouseControl/KeyboardAndMouseControl.ino diff --git a/build/shared/examples/9. USB (Leonardo only)/KeyboardAndMouseControl/KeyboardAndMouseControl.ino b/build/shared/examples/9. USB (Leonardo only)/KeyboardAndMouseControl/KeyboardAndMouseControl.ino deleted file mode 100644 index 21019be45..000000000 --- a/build/shared/examples/9. USB (Leonardo only)/KeyboardAndMouseControl/KeyboardAndMouseControl.ino +++ /dev/null @@ -1,94 +0,0 @@ - -/* - ButtonMouseControl - - Controls the mouse from five pushbuttons on an Arduino Leonardo. - - Hardware: - * 5 pushbuttons attached to D2, D3, D4, D5, D6 - - - The mouse movement is always relative. This sketch reads - four pushbuttons, and uses them to set the movement of the mouse. - - WARNING: When you use the Mouse.move() command, the Arduino takes - over your mouse! Make sure you have control before you use the mouse commands. - - created 15 Mar 2012 - modified 27 Mar 2012 - by Tom Igoe - - this code is in the public domain - - */ - -// set pin numbers for the five buttons: - -// set pin numbers for the five buttons: -const int upButton = 2; -const int downButton = 3; -const int leftButton = 4; -const int rightButton = 5; -const int mouseButton = 6; - -void setup() { // initialize the buttons' inputs: - pinMode(upButton, INPUT); - pinMode(downButton, INPUT); - pinMode(leftButton, INPUT); - pinMode(rightButton, INPUT); - pinMode(mouseButton, INPUT); - - Serial.begin(9600); - // initialize mouse control: - Mouse.begin(); - Keyboard.begin(); -} - -void loop() { - // use serial input to control the mouse: - if (Serial.available() > 0) { - char inChar = Serial.read(); - - switch (inChar) { - case 'u': - // move mouse up - Mouse.move(0, -40); - break; - case 'd': - // move mouse down - Mouse.move(0, 40); - break; - case 'l': - // move mouse left - Mouse.move(-40, 0); - break; - case 'r': - // move mouse right - Mouse.move(40, 0); - break; - case 'm': - // move mouse right - Mouse.click(MOUSE_LEFT); - break; - } - } - - // use the pushbuttons to control the keyboard: - if (digitalRead(upButton) == HIGH) { - Keyboard.write('u'); - } - if (digitalRead(downButton) == HIGH) { - Keyboard.write('d'); - } - if (digitalRead(leftButton) == HIGH) { - Keyboard.write('l'); - } - if (digitalRead(rightButton) == HIGH) { - Keyboard.write('r'); - } - if (digitalRead(mouseButton) == HIGH) { - Keyboard.write('m'); - } - -} -