# library error \['Keyboard' not found\] when \[#include \<Keyboard.h\>\] is included

**URL:** <https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788>\
**Category:** IDE 1.x\
**Created:** [January 7, 2020, 2:48am UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788 "2020-01-07T02:48:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DIY-Systems](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@DIY-Systems](https://forum.arduino.cc/u/DIY-Systems)\
**Post date:** [January 7, 2020, 2:48am UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788/1 "2020-01-07T02:48:41Z")

</div>

With a brand new install of Arduino IDE with either 1.8.10 or 1.9 beta, on either windows or linux I have the error:

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

This happens even with the example sketch via "File\>Examples\>USB\>Keyboard\>KeyboardMessage" and it does contain #include \<Keyboard.h\>

Am I missing something obvious? is this a bug?

One Example of "full" Error Message:

Arduino: 1.9.0-beta (Linux), Board: "Arduino/Genuino Uno"  
~  
/home/ubuntu/Downloads/arduino-PR-beta1.9-BUILD-116/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino: In function 'void setup()':  
KeyboardMessage:33:3: error: 'Keyboard' not found. Does your sketch include the line '#include \<Keyboard.h\>'?  
Keyboard.begin();  
^ ~~~~~~~  
/home/ubuntu/Downloads/arduino-PR-beta1.9-BUILD-116/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino: In function 'void loop()':  
KeyboardMessage:46:5: error: 'Keyboard' not found. Does your sketch include the line '#include \<Keyboard.h\>'?  
Keyboard.print("You pressed the button ");  
^ ~~~~~~~  
Multiple libraries were found for "Keyboard.h"  
Used: /home/ubuntu/Downloads/arduino-PR-beta1.9-BUILD-116/libraries/Keyboard  
Multiple libraries were found for "HID.h"  
Used: /home/ubuntu/Downloads/arduino-PR-beta1.9-BUILD-116/hardware/arduino/avr/libraries/HID  
Using library Keyboard at version 1.0.2 in folder: /home/ubuntu/Downloads/arduino-PR-beta1.9-BUILD-116/libraries/Keyboard  
Using library HID at version 1.0 in folder: /home/ubuntu/Downloads/arduino-PR-beta1.9-BUILD-116/hardware/arduino/avr/libraries/HID  
exit status 1  
'Keyboard' not found. Does your sketch include the line '#include \<Keyboard.h\>'?

---

<div class="post-metadata">

**Author:** ![pert](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/pert/32/217111_2.png) [@pert](https://forum.arduino.cc/u/pert)\
**Post date:** [January 7, 2020, 2:51am UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788/2 "2020-01-07T02:51:44Z")

</div>

The Keyboard and Mouse libraries are not compatible with the Uno board you are compiling for. If you have an Uno board, you will not be able to use these libraries. You would need to get a board with native USB functionality (e.g., Leonardo, Micro, MKR, Nano 33 IoT, Zero, Due) to use these libraries. If you do have a board with native USB, then you need to select the correct board from the IDE's **Tools \> Board** menu.

---

<div class="post-metadata">

**Author:** ![DIY-Systems](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@DIY-Systems](https://forum.arduino.cc/u/DIY-Systems)\
**Post date:** [January 7, 2020, 2:59am UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788/3 "2020-01-07T02:59:41Z")

</div>

The reference states "These core libraries allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due and MKR Family) to appear as a native Mouse and/or Keyboard to a connected computer."

I had it set to the Nano, and thats apparently not compatible regardless if some people said it was

---

<div class="post-metadata">

**Author:** ![pert](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/pert/32/217111_2.png) [@pert](https://forum.arduino.cc/u/pert)\
**Post date:** [January 7, 2020, 3:07am UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788/4 "2020-01-07T03:07:38Z")

</div>

> DIY-Systems:  
> The reference states "These core libraries allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due and MKR Family) to appear as a native Mouse and/or Keyboard to a connected computer."

Yeah, that was the "obvious" thing you missed, but I didn't want to say it.

> DIY-Systems:  
> I had it set to the Nano

No. You had it set to Uno:

> DIY-Systems:  
> Arduino: 1.9.0-beta (Linux), Board: "Arduino/Genuino Uno"

> DIY-Systems:  
> thats apparently not compatible regardless if some people said it was

Where did you see people saying it was compatible? The [original Nano](https://store.arduino.cc/arduino-nano) is not compatible. The [Nano Every](https://store.arduino.cc/arduino-nano-every) is not compatible. The [Nano 33 BLE](https://store.arduino.cc/arduino-nano-33-ble) boards are not compatible, though support will likely be added in the future. The [Nano 33 IoT](https://store.arduino.cc/arduino-nano-33-iot) is compatible.

---

<div class="post-metadata">

**Author:** ![cinarsehreman](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@cinarsehreman](https://forum.arduino.cc/u/cinarsehreman)\
**Post date:** [September 16, 2020, 10:56am UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788/5 "2020-09-16T10:56:22Z")

</div>

I have an arduino micro but still gives the same error in code

---

<div class="post-metadata">

**Author:** ![pert](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/pert/32/217111_2.png) [@pert](https://forum.arduino.cc/u/pert)\
**Post date:** [September 16, 2020, 12:37pm UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788/6 "2020-09-16T12:37:49Z")

</div>

You need to select **Tools \> Board \> Arduino AVR Boards \> Arduino Micro** from the Arduino IDE's menu.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 4:24pm UTC](https://forum.arduino.cc/t/library-error-keyboard-not-found-when-include-keyboard-h-is-included/629788/7 "2021-05-05T16:24:24Z")

</div>

Closed on May 5, 2021, 4:24pm UTC


