Tutorial.KeyboardMessage History

Hide minor edits - Show changes to output

August 28, 2015, at 04:09 PM by Simone Maiocchi -
Changed lines 1-6 from:
(:div class=breadcrumb:)
[[Tutorial.HomePage | Tutorials]] > [[Tutorial.Examples | Examples]] > USB > Keyboard >KeyboardMessage
(:divend:)

(:*toc:)
to:
(:html:)

<div class="subHeader row">

<div class="breadcrumb columns large-10 medium-10">
<p>
<a class="wikilink" href="/en/Tutorial/HomePage">Tutorials </a>
> <a class="wikilink" href="/en/Tutorial/BuiltInExamples"> Built-In Examples </a> > 09.USB > KeyboardMessage
</p>
</div>
</div>

(:htmlend:)

Added lines 22-23:

!!!Hardware Required
Deleted line 24:
!!!Hardware Required
Changed lines 28-29 from:
to:
(:divend:)
Changed lines 33-34 from:
(:divend:)
to:

Added line 36:
(:div class=circuit:)
Changed lines 42-43 from:
(:div class=circuit:)
to:

Changed lines 62-68 from:
(:include LeonardoSeeAlsoInclude:)
to:
* [[KeyboardLogout]] - Logs out the current user with key commands.
* [[KeyboardReprogram]] - Opens a new window in the Arduino IDE and reprograms the Leonardo with a simple blink program.
* [[KeyboardSerial]] - Reads a byte from the serial port, and sends back a keystroke.
* [[KeyboardAndMouseControl]] - Demonstrates the Mouse and Keyboard commands in one program.
* [[ButtonMouseControl]] - Control cursor movement with 5 pushbuttons.
* [[JoystickMouseControl]] - Controls a computer's cursor movement with a Joystick when a button is pressed.
July 29, 2015, at 04:21 PM by Simone Maiocchi -
Changed lines 50-53 from:
(:include LeonardoSeeAlsoInclude:)
to:
(:include LeonardoSeeAlsoInclude:)
\\
''Last revision 2015/07/29 by SM ''
July 09, 2015, at 11:52 AM by Simone Maiocchi -
Changed lines 1-3 from:
''Examples > Keyboard Library''

!!!Keyboard Message
to:
(:div class=breadcrumb:)
[[Tutorial.HomePage | Tutorials]] &gt; [[Tutorial.Examples | Examples]] &gt; USB &gt; Keyboard &gt;KeyboardMessage
(:divend:)

(:*toc:)

!!Keyboard Message
Changed line 14 from:
'''Hardware Required'''
to:
!!!Hardware Required
Changed lines 16-19 from:
* One momentary pushbutton
* One 10-kiloohm resistor

'''Software Required'''
to:
* momentary pushbutton
* 10k ohm resistor

!!!Software Required
Changed lines 24-28 from:
'''Circuit'''\\
Attach one end of the pushbutton to pin 4 on the Arduino. Attach the other end to power. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.

Once you've programmed your board, unplug the USB cable and open a text editor. Connect the board to your computer and press the button to write in the document.
to:
!!!Circuit
Attach one pin of the pushbutton to pin 4 on the Arduino. Attach the other pin to 5V. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.

Once you've programmed your board, unplug the USB cable, open a text editor and put the text cursor at in the typing area. Connect the board to your computer through USB again and press the button to write in the document.
Changed line 39 from:
'''Code'''
to:
!!!Code
Changed line 46 from:
'''See Also'''
to:
!!!See Also
November 11, 2013, at 01:57 PM by Scott Fitzgerald -
Changed line 28 from:
%height=300px%[[Attach:KeyboardMessage3_bb.png | Attach:KeyboardMessage_2_bb.png]]
to:
%height=300px%[[Attach:KeyboardMessage3_bb.png | Attach:KeyboardMessage3_bb.png]]
Changed lines 31-32 from:
%height=300px%[[Attach:KeyboardMessage_schem.png | Attach:KeyboardMessage3_schem.png]]
to:
%height=300px%[[Attach:KeyboardMessage3_schem.png | Attach:KeyboardMessage3_schem.png]]
November 11, 2013, at 01:57 PM by Scott Fitzgerald -
Changed line 28 from:
%height=300px%[[Attach:KeyboardMessage_2_bb.png | Attach:KeyboardMessage_2_bb.png]]
to:
%height=300px%[[Attach:KeyboardMessage3_bb.png | Attach:KeyboardMessage_2_bb.png]]
Changed lines 31-32 from:
%height=300px%[[Attach:KeyboardMessage_schem.png | Attach:KeyboardMessage_schem.png]]
to:
%height=300px%[[Attach:KeyboardMessage_schem.png | Attach:KeyboardMessage3_schem.png]]
November 11, 2013, at 01:49 PM by Scott Fitzgerald -
Changed line 38 from:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source https://raw.github.com/arduino/Arduino/master/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
October 31, 2012, at 09:54 PM by Scott Fitzgerald -
Changed lines 21-24 from:
Attach one end of the pushbutton to pin 4 on the Leonardo. Attach the other end it +5V. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.

Once you've programmed your Leonardo, unplug the USB cable and open a text editor. Connect your Leonardo board to your computer and press the button to write in the document.
to:
Attach one end of the pushbutton to pin 4 on the Arduino. Attach the other end to power. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.

Once you've programmed your board, unplug the USB cable and open a text editor. Connect the board to your computer and press the button to write in the document.
October 31, 2012, at 09:47 PM by Scott Fitzgerald -
Changed line 11 from:
* Arduino Leonardo or Arduino Due board
to:
* Arduino Leonardo, Micro, or Due board
Changed line 36 from:
(:div class=code :)
to:
(:div class=code :)
Changed line 38 from:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.USB/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
October 31, 2012, at 09:44 PM by Scott Fitzgerald -
Added lines 36-38:
(:div class=code :)

(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.USB/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
Deleted lines 39-89:
(:div class=code :)
(:source lang=arduino tabwidth=4:)
/*
Keyboard Button test

Sends a text string when a button is pressed.

The circuit:
* pushbutton attached from pin 2 to +5V on AVR boards
and to +3.3V to the Arduino Due
* 10-kilohm resistor attached from pin 2 to ground

created 24 Oct 2011
modified 27 Mar 2012
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/KeyboardButton
*/

const int buttonPin = 2; // input pin for pushbutton
int previousButtonState = HIGH; // for checking the state of a pushButton
int counter = 0; // button push counter

void setup() {
// make the pushButton pin an input:
pinMode(buttonPin, INPUT);
// initialize control over the keyboard:
Keyboard.begin();
}

void loop() {
// read the pushbutton:
int buttonState = digitalRead(buttonPin);
// if the button state has changed,
if ((buttonState != previousButtonState)
// and it's currently pressed:
&& (buttonState == HIGH)) {
// increment the button counter
counter++;
// type out a message
Keyboard.print("You pressed the button ");
Keyboard.print(counter);
Keyboard.println(" times.");
}
// save the current button state for comparison next time:
previousButtonState = buttonState;
}

(:sourceend:)
October 22, 2012, at 11:18 AM by Federico -
Changed lines 4-6 from:
When the button is pressed in this example, a text string is sent to the computer as keyboard input. The string reports the number of times the button has been pressed. Once you have the Leonardo programmed and wired up, open up your favorite text editor to see the results.

to:
When the button is pressed in this example, a text string is sent to the computer as keyboard input. The string reports the number of times the button has been pressed. Once you have the Leonardo programmed and wired up, open up your favourite text editor to see the results.

Changed line 11 from:
* Arduino Leonardo board
to:
* Arduino Leonardo or Arduino Due board
Changed lines 45-46 from:
* pushbutton attached from pin 2 to +5V
* 10-kilohm resistor attached from pin 4 to ground
to:
* pushbutton attached from pin 2 to +5V on AVR boards
and to +3.3V to the Arduino Due
* 10-kilohm resistor attached from pin 2 to ground
Changed line 58 from:
const int buttonPin = 4; // input pin for pushbutton
to:
const int buttonPin = 2; // input pin for pushbutton
October 19, 2012, at 11:57 AM by Federico -
Changed line 57 from:
const int buttonPin = 2; // input pin for pushbutton
to:
const int buttonPin = 4; // input pin for pushbutton
May 21, 2012, at 07:43 PM by Scott Fitzgerald -
Changed lines 38-86 from:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.USB(Leonardo)/Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source lang=arduino tabwidth=4:)
/*
Keyboard Button test

Sends a text string when a button is pressed.

The circuit:
* pushbutton attached from pin 2 to +5V
* 10-kilohm resistor attached from pin 4 to ground

created 24 Oct 2011
modified 27 Mar 2012
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/KeyboardButton
*/

const int buttonPin = 2; // input pin for pushbutton
int previousButtonState = HIGH; // for checking the state of a pushButton
int counter = 0; // button push counter

void setup() {
// make the pushButton pin an input:
pinMode(buttonPin, INPUT);
// initialize control over the keyboard:
Keyboard.begin();
}

void loop() {
// read the pushbutton:
int buttonState = digitalRead(buttonPin);
// if the button state has changed,
if ((buttonState != previousButtonState)
// and it's currently pressed:
&& (buttonState == HIGH)) {
// increment the button counter
counter++;
// type out a message
Keyboard.print("You pressed the button ");
Keyboard.print(counter);
Keyboard.println(" times.");
}
// save the current button state for comparison next time:
previousButtonState = buttonState;
}

(:sourceend:)
May 02, 2012, at 04:13 PM by Scott Fitzgerald -
Changed line 38 from:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.USB(Leonardo)/Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
April 27, 2012, at 06:54 PM by Scott Fitzgerald -
Changed lines 7-8 from:
'''NB: When you use the Keybaord.print() command, the Arduino takes over your computer's keyboard! To insure you don't lose control of your computer while running a sketch with this function, make sure to set up a reliable control system before you call Keyboard.print(). This sketch includes a pushbutton to toggle the keyboard, so that it only runs after a button is depressed.'''
to:
'''NB: When you use the Keyboard.print() command, the Arduino takes over your computer's keyboard! To insure you don't lose control of your computer while running a sketch with this function, make sure to set up a reliable control system before you call Keyboard.print(). This sketch includes a pushbutton to toggle the keyboard, so that it only runs after the button is pressed.'''
April 27, 2012, at 05:44 PM by Scott Fitzgerald -
Changed line 28 from:
%height=300px%[[Attach:KeyboardMessage_bb.png | Attach:KeyboardMessage_bb.png]]
to:
%height=300px%[[Attach:KeyboardMessage_2_bb.png | Attach:KeyboardMessage_2_bb.png]]
Changed line 38 from:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/9.Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/09.Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
Added line 45:
(:include LeonardoSeeAlsoInclude:)
March 28, 2012, at 07:21 PM by Scott Fitzgerald -
Deleted line 38:
(:sourceend:)
Deleted line 44:
\\
March 28, 2012, at 07:21 PM by Scott Fitzgerald -
Changed line 20 from:
'''Circuit'''
to:
'''Circuit'''\\
Added line 39:
(:sourceend:)
March 28, 2012, at 07:20 PM by Scott Fitzgerald -
Added lines 21-25:
Attach one end of the pushbutton to pin 4 on the Leonardo. Attach the other end it +5V. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.

Once you've programmed your Leonardo, unplug the USB cable and open a text editor. Connect your Leonardo board to your computer and press the button to write in the document.

[-click the images to enlarge-]
Changed lines 27-32 from:
Attach one end of the pushbutton to pin 4 on the Leonardo. Attach the other end it +5V. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.

Once you've programmed your Leonardo, unplug the USB cable and open a text editor. Connect your Leonardo board to your computer and press the button to write in the document.

[-click the images to enlarge-]
to:
March 28, 2012, at 07:19 PM by Scott Fitzgerald -
Changed lines 22-23 from:
Connect your Leonardo board to your computer with a micro-USB cable. Attach one end of the pushbutton to pin 4 on the Leonardo. Attach the other end it +5V. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.
to:
Attach one end of the pushbutton to pin 4 on the Leonardo. Attach the other end it +5V. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.

Once you've programmed your Leonardo, unplug the USB cable and open a text editor. Connect your Leonardo board to your computer and press the button to write in the document.
Changed line 45 from:
\\
to:
\\
December 07, 2011, at 01:44 AM by Scott Fitzgerald -
Changed lines 39-42 from:
to:
'''See Also'''
*[[/Reference/KeyboardWrite | Keyboard.write]]()
*[[/Reference/KeyboardPrint | Keyboard.print]]()
*[[/Reference/KeyboardPrintln | Keyboard.println]]()
December 07, 2011, at 01:18 AM by Scott Fitzgerald -
Changed lines 7-8 from:
'''NB: When you use the Keybaord.print() command, the Arduino takes over your computer's keyboard! To insure you don't lose control of your computer while running a sketch with this function, make sure to set up a reliable control system before you call Keyboard.move(). This sketch includes a pushbutton to toggle the keyboard, so that it only runs after a button is depressed.'''
to:
'''NB: When you use the Keybaord.print() command, the Arduino takes over your computer's keyboard! To insure you don't lose control of your computer while running a sketch with this function, make sure to set up a reliable control system before you call Keyboard.print(). This sketch includes a pushbutton to toggle the keyboard, so that it only runs after a button is depressed.'''
December 07, 2011, at 01:16 AM by Scott Fitzgerald -
Added lines 6-8:

'''NB: When you use the Keybaord.print() command, the Arduino takes over your computer's keyboard! To insure you don't lose control of your computer while running a sketch with this function, make sure to set up a reliable control system before you call Keyboard.move(). This sketch includes a pushbutton to toggle the keyboard, so that it only runs after a button is depressed.'''
November 28, 2011, at 09:08 PM by Scott Fitzgerald -
Changed line 33 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Keyboard/examples/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/9.Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
November 27, 2011, at 05:12 PM by Scott Fitzgerald -
Changed line 33 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Keyboard/Examples/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Keyboard/examples/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
November 27, 2011, at 05:11 PM by Scott Fitzgerald -
Changed line 33 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Keyboard/Examples/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
November 22, 2011, at 12:49 AM by Scott Fitzgerald -
Added line 18:
(:div class=circuit:)
Changed lines 21-29 from:
to:
[-click the images to enlarge-]

%height=300px%[[Attach:KeyboardMessage_bb.png | Attach:KeyboardMessage_bb.png]]
[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|Fritzing project page]] -]

%height=300px%[[Attach:KeyboardMessage_schem.png | Attach:KeyboardMessage_schem.png]]

(:divend:)
November 19, 2011, at 06:37 PM by Scott Fitzgerald -
Added lines 1-28:
''Examples > Keyboard Library''

!!!Keyboard Message
When the button is pressed in this example, a text string is sent to the computer as keyboard input. The string reports the number of times the button has been pressed. Once you have the Leonardo programmed and wired up, open up your favorite text editor to see the results.

(:div class=BOM :)
'''Hardware Required'''
* Arduino Leonardo board
* One momentary pushbutton
* One 10-kiloohm resistor

'''Software Required'''
*Any text editor

(:divend:)

'''Circuit'''
Connect your Leonardo board to your computer with a micro-USB cable. Attach one end of the pushbutton to pin 4 on the Leonardo. Attach the other end it +5V. Use the resistor as a pull-down, providing a reference to ground, by attaching it from pin 4 to ground.


'''Code'''

(:div class=code :)
(:source http://arduino.cc/en/pub/code/master/libraries/Keyboard/KeyboardMessage/KeyboardMessage.ino lang=arduino tabwidth=4:)
(:divend:)


\\

Share