Keyboard error

Hello everybody !

i want my arduino to “press” a key in my computer when Digital 2 is low

(when the sensor give 0v to pin D2, the arduino simulate pressing Ctrl and F1 on the computer (via USB), the computer launch a program when these keys are pressed on the “real” keyboard.

For this, i use Keyboard.h

i followed a youtube tutorial, but i get an error that have no sense.

i tried to do this project with an AnalogRead then with an DigitalRead

i let you watch the screenshot and (if possible) help me…

(Sorry if i don’t speak english very well, i’m french)

The screenshot :
http://www.cjoint.com/data/FHBwETW7Arc_Capture-d’écran-10532-.png

http://www.cjoint.com/data/FHBwGQS4b1c_Capture-d’écran-10533-.png

The error (translated) is "Are you sure that your sketch includes the line ‘#include <Keyboard.h>’ ?

What type of Arduino are you using? See here: The keyboard library only works for some Arduinos.

i'm using a Arduino Leonardo, is this card compatible?

It will work on Leonardo, but the screenshots show you have Uno as the target.

Select Tools > Board > Leonardo.

Ok ! i habitually work on an Arduino Uno, i don't changed the board in the options menu...

i uploaded the sketch (after restarted Arduino IDE), and all work fine !

Thank you very much :slight_smile: