Skip to content

Commit 1b6b2cb

Browse files
committed
keyboardModifiers: rewrite the introductory text
The main purpose of the page Language/Functions/USB/Keyboard/keyboardModifiers.adoc is to list the macros representing keys. Refocus the text accordingly.
1 parent 305a180 commit 1b6b2cb

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

Language/Functions/USB/Keyboard/keyboardModifiers.adoc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,26 @@ title: Keyboard Modifiers and Special Keys
1414

1515
[float]
1616
=== Description
17-
The `Keyboard.write()` and `Keyboard.press()` and `Keyboard.release()` commands don’t work with every possible ASCII character, only those that correspond to a key on the keyboard. For example, backspace works, but many of the other non-printable characters produce unpredictable results. For capital letters (and other keys), what’s sent is shift plus the character (i.e. the equivalent of pressing both of those keys on the keyboard).
17+
When given a printable ASCII character as an argument, the functions `Keyboard.write()`, `Keyboard.press()` and `Keyboard.release()` simulate actuations on the corresponding keys. These functions can also handle ASCII characters that require pressing a key in combination with Shift or, on international keyboards, AltGr. For example:
18+
[source,arduino]
19+
----
20+
Keyboard.write('a'); // press and release the 'A' key
21+
Keyboard.write('A'); // press Shift and 'A', then release both
22+
----
23+
A typical keyboard, however, has many keys that do not match a printable ASCII character. In order to simulate those keys, the library provides a set of macros that can be passed as arguments to `Keyboard.write()`, `Keyboard.press()` and `Keyboard.release()`. For example, the key combination Shift-F2 can be generated by:
24+
[source,arduino]
25+
----
26+
Keyboard.press(KEY_LEFT_SHIFT); // press and hold Shift
27+
Keyboard.press(KEY_F2); // press and hold F2
28+
Keyboard.releaseAll(); // release both
29+
----
30+
Note that, in order to press multiple keys simultaneously, one has to use link:../keyboardpress[`Keyboard.press()`] rather than link:../keyboardwrite[`Keyboard.write()`], as the latter just “hits” the keys (it presses and immediate releases them).
1831
[%hardbreaks]
19-
For more on ASCII values and the characters or functions they represent, see http://www.asciitable.com/[asciitable.com]
32+
The available macros are listed below:
2033

2134
[float]
2235
=== Keyboard modifiers
23-
A modifier key is a special key on a computer keyboard that modifies the normal action of another key when the two are pressed in combination.
24-
[%hardbreaks]
25-
For multiple key presses use link:../keyboardpress[Keyboard.press]()
26-
[%hardbreaks]
27-
The definitions of the modifier keys are listed below:
28-
[%hardbreaks]
29-
36+
These are eight keys within the alphanumeric cluster of the keyboard that are meant to modify the normal action of another key when the two are pressed in combination. Whereas Shift and AltGr are used to access extra characters, the others are mostly used for keyboard shortcuts.
3037

3138
|===
3239
|Key |Hexadecimal value |Decimal value
@@ -43,9 +50,7 @@ The definitions of the modifier keys are listed below:
4350

4451
[float]
4552
=== Special keys
46-
These are four keys within the alphanumeric cluster of a keyboard (Tab, Caps Lock, Backspace and Return) as well as all keys from outside that cluster (Escape, function keys, Home, End, arrow keys...).
47-
48-
The following special keys have been defined:
53+
These are all the keys that do not match a printable ASCII character and are not modifiers, including all keys outside the alphanumeric cluster.
4954

5055
|===
5156
|Key |Hexadecimal value |Decimal value

0 commit comments

Comments
 (0)