Library Installed but error message says "No file or directory"

I have found similar posts on this topic however I have not came across the answer yet.
I am using an Arduino Nano ESP32 and the Keyboard library by Arduino.
Here is the code:

#include "keyboard.h"

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

And here is the full error message:

C:\Users\austi\OneDrive\Arduino\NanoESP32Testing\NanoESP32Testing.ino:1:10: fatal error: keyboard.h: No such file or directory
 #include "keyboard.h"
          ^~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: keyboard.h: No such file or directory

I hope that this is sufficient information but if not please let me know.

Welcome to the forum

Where exactly is keyboard.h located on your PC ?

Which board do you have selected in the IDE ?

case matters... try

#include "Keyboard.h"

keyboard.h is saved under:
onedrive > austi > arduino > libraries > keyboard > src

and the board selected is arduino Nano ESP32 connected on COM4

Great suggestion, just tried that again but I still get the same error message.

On my installation the file is named Keyboard.h

Please post your revised sketch and the full error message

on second thought - I'm not. even sure the Arduino Nano ESP32 supports the usual Keyboard library. shouldn't it be USBHIDKeyboard.h ?

1 Like

This page seems to suggest that it does, and we all know that the Arduino pages are never wrong

https://docs.arduino.cc/language-reference/en/functions/usb/Keyboard/

#include "Keyboard.h"

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

In file included from C:\Users\austi\OneDrive\Arduino\NanoESP32Testing\NanoESP32Testing.ino:1:
c:\Users\austi\OneDrive\Arduino\libraries\Keyboard\src/Keyboard.h:25:10: fatal error: HID.h: No such file or directory
 #include "HID.h"
          ^~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

You selected the COM4 but did you set the board's type to arduino Nano ESP32?

When I try it I do NOT get the same error; I still get an error though.

:rofl:

Possible... the page starts with this text

The keyboard functions enable 32u4 or SAMD micro based boards to send keystrokes to an attached computer through their micro’s native USB port.

Not sure the Nano EPS32 does meet this description...

1 Like

yes i did

I've just reread the error message and it is not quite the same you're right

But it also mentions

Not sure what the pins have to do with it though :confused:

1 Like

the error message implies that it has actually found the library but the problem may occur opening it?

can you try compiling the example I pointed out in post #7 ?

This works fine without any errors, will this library do everything the other library does but just with different syntax?

Do you have specific requirements ?

it does support various keyboards

and specific keys

This should work for what i want it to do, thank you J-M-L and sterretje.