What is wrong with this?

#include “Keyboard.h”

void typeKey(int key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}

/* Init function */
void setup()
{
// Begining the Keyboard stream
Keyboard.begin();

// Wait 500ms
delay(500);

delay(500);

Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(KEY_F4);
Keyboard.releaseAll();

delay(500);

Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(KEY_F4);
Keyboard.releaseAll();

delay(500);

Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(KEY_F4);
Keyboard.releaseAll();

delay(500);

// Ending stream
Keyboard.end();
}

/* Unused endless loop */
void loop() {}

i keep getting this error message;

exit status 1
‘Keyboard’ not found. Does your sketch include the line ‘#include <Keyboard.h>’?

and i if i put that i get the same error message

may be that you are not using code tags? :grin: (or the wrong arduino which does not support the keyboard library - and also that you typeKey() function releases the key so you can’t combine ALT-F4 for example)


Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

Which board are you trying to compile for?

I get the same error if I try to compile the sketch for an Arduino UNO.

When I switch to an Arduino Leonardo, which has support for the Keyboard library, I get no error.