Reference.KeyboardPress History

Hide minor edits - Show changes to output

April 27, 2012, at 10:43 PM by Scott Fitzgerald -
Changed lines 55-56 from:
\\
\\
to:

!!!!See Also
*[[/Reference/KeyboardBegin | Keyboard.begin]]()
*[[/Reference/KeyboardEnd | Keyboard.end]]()
*[[/Reference/KeyboardPrint | Keyboard.print]]()
*[[/Reference/KeyboardPrintln | Keyboard.println]]()
*[[/Reference/KeyboardRelease | Keyboard.release]]()
*[[/Reference/KeyboardReleaseAll | Keyboard.releaseAll]]()
*[[/Reference/KeyboardWrite | Keyboard.write]]()
March 28, 2012, at 08:58 PM by Scott Fitzgerald -
Changed lines 7-8 from:
When called, press() functions as if you press and hold a key on your keyboard. Useful when using [[/Reference/KeyboardModifiers | modifiers]].
to:
When called, Keyboard.press() functions as if a key were pressed and held on your keyboard. Useful when using [[/Reference/KeyboardModifiers | modifier keys]]. To end the key press, use [[/Reference/KeyboardRelease | Keyboard.release]]() or [[/Reference/KeyboardReleaseAll | Keyboard.releaseAll]]().

It is necessary to call [[/Reference/KeyboardBegin | Keyboard.begin]]() before using press().
Changed lines 20-54 from:
None\\
to:
None

!!!!Example
(:source lang=arduino:)

// use this option for OSX:
char ctrlKey = KEY_LEFT_GUI;
// use this option for Windows and Linux:
// char ctrlKey = KEY_LEFT_CTRL;

void setup() {
// make pin 2 an input and turn on the
// pullup resistor so it goes high unless
// connected to ground:
pinMode(2, INPUT_PULLUP);
// initialize control over the keyboard:
Keyboard.begin();
}

void loop() {
while (digitalRead(2) == HIGH) {
// do nothing until pin 2 goes low
delay(500);
}
delay(1000);
// new document:
Keyboard.press(ctrlKey);
Keyboard.press('n');
delay(100);
Keyboard.releaseAll();
// wait for new window to open:
delay(1000);
}

(:sourceend:)
Added line 56:
\\
March 28, 2012, at 01:05 AM by Scott Fitzgerald -
Changed lines 7-8 from:
presses and holds a key. useful for using [[/Reference/KeyboardModifiers | modifiers]]
to:
When called, press() functions as if you press and hold a key on your keyboard. Useful when using [[/Reference/KeyboardModifiers | modifiers]].
March 16, 2012, at 09:48 PM by Scott Fitzgerald -
Changed lines 7-8 from:
presses and holds a key. useful for using [[/Reference|KeyboardModifiers | modifiers]]
to:
presses and holds a key. useful for using [[/Reference/KeyboardModifiers | modifiers]]
March 16, 2012, at 09:48 PM by Scott Fitzgerald -
Added lines 1-19:
[[Reference/MouseKeyboard | Keyboard]]

!!Keyboard.press()

!!!!Description

presses and holds a key. useful for using [[/Reference|KeyboardModifiers | modifiers]]

!!!!Syntax
Keyboard.press()\\

!!!!Parameters

char : the key to press

!!!!Returns

None\\
\\

Share