Keyboard example error

Hello

I'm trying to upload arduino example from File>Examples>09.USB>Keyboard>KeyboardSerial but every time I get error code;

Arduino: 1.6.1 (Windows 7), Board: "Arduino Uno"
KeyboardSerial.ino: In function 'void setup()':
KeyboardSerial.ino:26:3: error: 'Keyboard' was not declared in this scope
KeyboardSerial.ino: In function 'void loop()':
KeyboardSerial.ino:35:5: error: 'Keyboard' was not declared in this scope
Error compiling.
** This report would have more information with**
** "Show verbose output during compilation"**
** enabled in File > Preferences.**

I don't know what is the error source btw it is prewriten arduino library example so how it can run wrong. I'm using laptop and tried connect other usb keyboard but nothings changed. Please help me :slightly_frowning_face:

Here is the prewriten arduino example code;

/*
 Keyboard test

 For the Arduino Leonardo, Micro or Due

 Reads a byte from the serial port, sends a keystroke back.
 The sent keystroke is one higher than what's received, e.g.
 if you send a, you get b, send A you get B, and so forth.

 The circuit:
 * none

 created 21 Oct 2011
 modified 27 Mar 2012
 by Tom Igoe

 This example code is in the public domain.

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

void setup() {
  // open the serial port:
  Serial.begin(9600);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  // check for incoming serial data:
  if (Serial.available() > 0) {
    // read incoming serial data:
    char inChar = Serial.read();
    // Type the next ASCII value from what you received:
    Keyboard.write(inChar + 1);
  }
}

Where did you install the library? Usually that type of error is because the library is not installed properly. The library folder name must be the same as the .h and .cpp filenames. The library goes into the library folder of your sketchbook.

The Keyboard and Mouse features don't work on an Arduino UNO. You need a Leonardo or other ATmega32u4-based board.

johnwasser:
The Keyboard and Mouse features don't work on an Arduino UNO. You need a Leonardo or other ATmega32u4-based board.

Hi john,

are you sure about that? If it is not compatible with uno, do you know any library to do it with uno or mega? I'm trying to control my robot with computer keyboard.

thanks