Keyboard.h not found

For some time now i have a really annoying error. idk what happens but at some point my keyboard.h stops working completely. When compiling, I get the error message:

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\examples\09.USB\Keyboard\KeyboardMessage\KeyboardMessage.ino:23:0:

C:\Users\***\Documents\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\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\examples\09.USB\Keyboard\KeyboardMessage\KeyboardMessage.ino: In function 'void setup()':

KeyboardMessage:33:3: error: 'Keyboard' nicht gefunden. Beinhaltet Ihr Sketch die Zeile '#include <Keyboard.h>'?

   Keyboard.begin();

   ^~~~~~~~

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\examples\09.USB\Keyboard\KeyboardMessage\KeyboardMessage.ino: In function 'void loop()':

KeyboardMessage:46:5: error: 'Keyboard' nicht gefunden. Beinhaltet Ihr Sketch die Zeile '#include <Keyboard.h>'?

     Keyboard.print("You pressed the button ");

     ^~~~~~~~

Mehrere Bibliotheken wurden für "Keyboard.h" gefunden

 Benutzt: C:\Users\***\Documents\Arduino\libraries\Keyboard

 Nicht benutzt: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\Keyboard

exit status 1

'Keyboard' nicht gefunden. Beinhaltet Ihr Sketch die Zeile '#include <Keyboard.h>'?

Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.

I tried reinstalling the Ide and even clearing every file and folder with arduino in the name I can access. I Think there is an error with a file in the “C:\Program Files\WindowsApps\” folder but as a admin user you cant access it, at least via the file explorer. You need a special “trusted installer” permission to even look at the files in this location. Kinda sus that you arent allowed to look at files on your own machine even as an admin but some program has full access to it.

I use the Microsoft store Version of the arduino ide and I tried with multiple compatible boards such as Leonardo, pro micro (32u4) and the Mega 2560. The code i used was the message code that came with the lib. I have a suspicion that OOSU10.exe is causing my issues at some point as it is a tool to manipulate windows in normally unsupported ways to get rid of windows spyware and annoying “features”. I will keep it for now with my current setting though. My next move will be to try to delete the arduino files in the “C:\Program Files\WindowsApps” location via cmd or power shell.

I hope someone has a clue or a solution for me as reinstalling windows isn´t a solution I want to be stuck with.

From your error messages:

From the Keyboard reference page:

From the KeyboardMessage page:

Hardware Required

  • Arduino Leonardo, Micro, or Due board

The Mega is neither a Leonardo, Micro, Due, or any other kind of 32u4 or SAMD based board. Attempting to compile code meant for one of these boards when the Mega is selected will produce the errors shown, as you might expect.

When compiled for a 32u4 based board, such as the Pro Micro, the KeyboardMessage example compiles without error.

Oh well, with a 32u4 board it works now. A while ago i searched for Mega compatibility with usb communication and i thought that it would work for the keyboard lib, turns out it does not. However before cleaning all arduino files i found, i had the problem even with the supported 32u4 devices.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.