Skip to content

Commit 7f505c3

Browse files
committed
Merged 1.0.2
Merge remote-tracking branch 'arduino/master' into ide-1.5.x Conflicts: app/src/processing/app/debug/AvrdudeUploader.java build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.ino build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino build/shared/examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.ino build/shared/examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.ino hardware/arduino/boards.txt
2 parents b85ddc5 + 7b0ee4e commit 7f505c3

File tree

7 files changed

+104
-13
lines changed

7 files changed

+104
-13
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
Keyboard logout
3+
4+
This sketch demonstrates the Keyboard library.
5+
6+
When you connect pin 2 to ground, it performs a logout.
7+
It uses keyboard combinations to do this, as follows:
8+
9+
On Windows, CTRL-ALT-DEL followed by ALT-l
10+
On Ubuntu, CTRL-ALT-DEL, and ENTER
11+
On OSX, CMD-SHIFT-q
12+
13+
To wake: Spacebar.
14+
15+
Circuit:
16+
* Arduino Leonardo or Micro
17+
* wire to connect D2 to ground.
18+
19+
created 6 Mar 2012
20+
modified 27 Mar 2012
21+
by Tom Igoe
22+
23+
This example is in the public domain
24+
25+
http://www.arduino.cc/en/Tutorial/KeyboardLogout
26+
*/
27+
28+
#define OSX 0
29+
#define WINDOWS 1
30+
#define UBUNTU 2
31+
32+
// change this to match your platform:
33+
int platform = OSX;
34+
35+
void setup() {
36+
// make pin 2 an input and turn on the
37+
// pullup resistor so it goes high unless
38+
// connected to ground:
39+
pinMode(2, INPUT_PULLUP);
40+
Keyboard.begin();
41+
}
42+
43+
void loop() {
44+
while (digitalRead(2) == HIGH) {
45+
// do nothing until pin 2 goes low
46+
delay(500);
47+
}
48+
delay(1000);
49+
50+
switch (platform) {
51+
case OSX:
52+
Keyboard.press(KEY_LEFT_GUI);
53+
// Shift-Q logs out:
54+
Keyboard.press(KEY_LEFT_SHIFT);
55+
Keyboard.press('Q');
56+
delay(100);
57+
Keyboard.releaseAll();
58+
// enter:
59+
Keyboard.write(KEY_RETURN);
60+
break;
61+
case WINDOWS:
62+
// CTRL-ALT-DEL:
63+
Keyboard.press(KEY_LEFT_CTRL);
64+
Keyboard.press(KEY_LEFT_ALT);
65+
Keyboard.press(KEY_DELETE);
66+
delay(100);
67+
Keyboard.releaseAll();
68+
//ALT-s:
69+
delay(2000);
70+
Keyboard.press(KEY_LEFT_ALT);
71+
Keyboard.press('l');
72+
Keyboard.releaseAll();
73+
break;
74+
case UBUNTU:
75+
// CTRL-ALT-DEL:
76+
Keyboard.press(KEY_LEFT_CTRL);
77+
Keyboard.press(KEY_LEFT_ALT);
78+
Keyboard.press(KEY_DELETE);
79+
delay(1000);
80+
Keyboard.releaseAll();
81+
// Enter to confirm logout:
82+
Keyboard.write(KEY_RETURN);
83+
break;
84+
}
85+
86+
// do nothing:
87+
while(true);
88+
}
89+
90+
91+
92+
93+
94+
95+
96+

examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Keyboard Button test
33
4-
For Leonardo and Due boards only.
4+
For the Arduino Leonardo, Micro and Due boards.
55
66
Sends a text string when a button is pressed.
77

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
a final key combination (CTRL-U).
1414
1515
Circuit:
16-
* Arduino Leonardo or Arduino Due
16+
* Arduino Leonardo, Micro or Due
1717
* wire to connect D2 to ground.
1818
1919
created 5 Mar 2012

examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Keyboard test
33
4-
For Leonardo and Due boards only
4+
For the Arduino Leonardo, Micro or Due
55
66
Reads a byte from the serial port, sends a keystroke back.
77
The sent keystroke is one higher than what's received, e.g.
@@ -14,14 +14,14 @@
1414
modified 27 Mar 2012
1515
by Tom Igoe
1616
17-
This example code is in the public domain.
17+
This example code is in the public domain.
1818
1919
http://www.arduino.cc/en/Tutorial/KeyboardSerial
2020
*/
2121

2222
void setup() {
2323
// open the serial port:
24-
Serial.begin(9600);
24+
Serial.begin(9600);
2525
// initialize control over the keyboard:
2626
Keyboard.begin();
2727
}

examples/09.USB/KeyboardAndMouseControl/KeyboardAndMouseControl.ino

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
/*
33
KeyboardAndMouseControl
44
5-
For Leonardo and Due boards only.
6-
7-
Controls the mouse from five pushbuttons on an Arduino Leonardo.
5+
Controls the mouse from five pushbuttons on an Arduino Leonardo, Micro or Due.
86
97
Hardware:
108
* 5 pushbuttons attached to D2, D3, D4, D5, D6
119
12-
1310
The mouse movement is always relative. This sketch reads
1411
four pushbuttons, and uses them to set the movement of the mouse.
1512

examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
For Leonardo and Due boards only.
66
7-
Controls the mouse from five pushbuttons on an Arduino Leonardo or Due.
7+
Controls the mouse from five pushbuttons on an Arduino Leonardo, Micro or Due.
88
99
Hardware:
1010
* 5 pushbuttons attached to D2, D3, D4, D5, D6

examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.ino

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/*
22
JoystickMouseControl
33
4-
For Leonardo and Due boards only.
5-
6-
Controls the mouse from a joystick on an Arduino Leonardo or Due.
4+
Controls the mouse from a joystick on an Arduino Leonardo, Micro or Due.
75
Uses a pushbutton to turn on and off mouse control, and
86
a second pushbutton to click the left mouse button
97

0 commit comments

Comments
 (0)