Error "keyboard not found" "#include "Keyboard.h""

Hi,

I am a total noob and learning how to use the Arduino and hope that you are willing and able to help me.
I bought a Arduino Mega2560 and my idea is to eventually build a buttonbox with buttons and leds to assist me in my game play.

So i am starting to learn with the help of the build in sketches in IDE.
Thru understanding how these sketches work i want to build my own stuff.

The problem is when is use for example the “keyboardMessage” sketch and try to verify it i get error messages. (This is the build in sketch in IDE)
While searching the internet for a sollution i cannot find an explanation other then that the mega is not compatible.

So does that mean that you cannot use the mega as a keyboard simulator?

Hereby the error message:

Arduino: 1.8.0 (Windows 10), Board:“Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

In file included from C:\Program Files (x86)\Arduino\examples\09.USB\Keyboard\KeyboardMessage\KeyboardMessage.ino:23:0:

C:\Program Files (x86)\Arduino\libraries\Keyboard\src/Keyboard.h:29:2: warning: #warning “Using legacy HID core (non pluggable)” [-Wcpp]

#warning “Using legacy HID core (non pluggable)”

^

C:\Program Files (x86)\Arduino\examples\09.USB\Keyboard\KeyboardMessage\KeyboardMessage.ino: In function ‘void setup()’:

KeyboardMessage:33: error: ‘Keyboard’ niet gevonden. Bevindt de lijn ‘#include <Keyboard.h>’ zich in uw schets?
Keyboard.begin();

^

C:\Program Files (x86)\Arduino\examples\09.USB\Keyboard\KeyboardMessage\KeyboardMessage.ino: In function ‘void loop()’:

KeyboardMessage:46: error: ‘Keyboard’ niet gevonden. Bevindt de lijn ‘#include <Keyboard.h>’ zich in uw schets?
Keyboard.print("You pressed the button ");

^

exit status 1
‘Keyboard’ niet gevonden. Bevindt de lijn ‘#include <Keyboard.h>’ zich in uw schets?

Thanks!!

Theovt:
So does that mean that you cannot use the mega as a keyboard simulator?

That is exactly what it means. Perhaps you should have read this before you spent your money. You would have seen the very first sentence on that page and would have known better.