1

I am trying to use keyboard on my Arduino nano, but i get this error:

'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?

As per the answer in Keyboard.h not found, I tried change the board to Arduino Leonardo, even though the script gets compiled it doesn't get uploaded (keeps on saying uploading for a long time).

This is the code I use:

#include <Keyboard.h> 
void setup() {
  Keyboard.begin();
}
void loop() {
}
Johan Jomy
  • 113
  • 6

1 Answers1

1

To convert the comments into an answer:

You cannot (!) use the Keyboard library on the Arduino Uno/Nano/Mini. It needs a native USB interface to configure it as a HID device, but the Uno/Nano/Mini all use the Atmega328p, which doesn't have a native USB interface. These Arduinos use an additional chip on the board which acts as USB-UART-bridge.

You can compile the code for the Leonardo, because it has a native USB interface. But you cannot (!) upload code, which is compiled for the Leonardo, to an Uno/Nano/Mini. Its a completely different chip.

What to do now: Get an Arduino board which has a native USB interface, for example the Leonardo or the Micro.

chrisl
  • 16,622
  • 2
  • 18
  • 27