Loading...

Reference.KeyPressed History

Hide minor edits - Show changes to markup

October 16, 2012, at 03:54 PM by Scott Fitzgerald -
Changed lines 36-37 from:
  printKey();
to:
  Serial.print(keyboard.getKey());
  Serial.println();
October 16, 2012, at 03:12 PM by Scott Fitzgerald -
Changed lines 46-48 from:
to:
October 16, 2012, at 03:04 PM by Scott Fitzgerald -
Added lines 1-47:

USBHost : KeyboardController class

keyPressed()

Description

keyPressed() is a function that is called whenever a key is pressed on a connected USB keyboard.

Syntax

(:source lang=arduino tabwidth=4:) void keyPressed(){ //statements } (:sourceend:)

Example

(:source lang=arduino tabwidth=4:)

  1. include <KeyboardController.h>

// Initialize USB Controller USBHost usb;

// Attach Keyboard controller to USB KeyboardController keyboard(usb);

void setup(){

  Serial.begin(9600);

}

void loop(){

  usb.Task();

}

void keyPressed() {

  Serial.print("Pressed:  ");
  printKey();

} (:sourceend:)

See Also




Bookmark and Share