The IDE tells me the included library isn't? I tried restarting the IDE and my computer but it doesn't work. The other libraries work fine it's only with Keyboard that it fails.
My code:
#include <Keyboard.h>
int buttonState = 0;
void setup() {
pinMode(2, INPUT);
pinMode(13, OUTPUT);
Keyboard.begin();
}
void loop() {
buttonState = digitalRead(2);
if (buttonState == HIGH) {
digitalWrite(13, HIGH);
Keyboard.press('A');
} else {
digitalWrite(13, LOW);
Keyboard.releaseAll();
}
}
Error log:
Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"
D:\Documents\Test\Test.ino: In function 'void setup()':
Test:9: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
Keyboard.begin();
^
D:\Documents\Test\Test.ino: In function 'void loop()':
Test:16: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
Keyboard.press('A');
^
Test:19: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
Keyboard.releaseAll();
^
exit status 1
'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?