Home Page | Language Reference (extended) | SD Reference | Libraries | Comparison | Changes
When used with a Leonardo or Due board, Keyboard.begin() starts emulating a keyboard connected to a computer. To end control, use Keyboard.end().
Keyboard.begin()
none
nothing
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)
;
Keyboard.begin
(
)
;
}
void
loop
(
)
{
//if the button is pressed
if
(
digitalRead
(
2
)
==
LOW
)
{
//Send the message
Keyboard.print
(
"Hello!"
)
;
}
}
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.