u/DerKnoedel

Problem with Keyboard header files

I wanted to use my Nano as a one button keyboard for a project, and decided to start off with the Keyboard.h library

I'm not new to Arduino programming and have extensive knowledge in C/C++, I have built projects with my own code before.

I installed the Keyboard.h lib via the IDE (Linux appimage) and verified the files are in the sketchbook directory. In fact, here's my folder structure:

.
├── keyboard_test
│   └── keyboard_test.ino
└── libraries
    └── Keyboard
        ├── examples
        │   └── Serial
        │       └── Serial.ino
        ├── keywords.txt
        ├── library.properties
        ├── LICENSE
        ├── README.adoc
        └── src
            ├── Keyboard.cpp
            ├── Keyboard_da_DK.h
            ├── Keyboard_de_DE.h
            ├── Keyboard_es_ES.h
            ├── Keyboard_fr_FR.h
            ├── Keyboard.h
            ├── Keyboard_hu_HU.h
            ├── Keyboard_it_IT.h
            ├── KeyboardLayout_da_DK.cpp
            ├── KeyboardLayout_de_DE.cpp
            ├── KeyboardLayout_en_US.cpp
            ├── KeyboardLayout_es_ES.cpp
            ├── KeyboardLayout_fr_FR.cpp
            ├── KeyboardLayout.h
            ├── KeyboardLayout_hu_HU.cpp
            ├── KeyboardLayout_it_IT.cpp
            ├── KeyboardLayout_pt_PT.cpp
            ├── KeyboardLayout_sv_SE.cpp
            ├── Keyboard_pt_PT.h
            └── Keyboard_sv_SE.h

7 directories, 26 files

Using the example KeyboardMessage I get the following error:

/home/pascal/Arduino/keyboard_test/keyboard_test.ino: In function 'void setup()':
/home/pascal/Arduino/keyboard_test/keyboard_test.ino:33:3: error: 'Keyboard' was not declared in this scope
   Keyboard.begin();
   ^~~~~~~~
/home/pascal/Arduino/keyboard_test/keyboard_test.ino: In function 'void loop()':
/home/pascal/Arduino/keyboard_test/keyboard_test.ino:46:5: error: 'Keyboard' was not declared in this scope
     Keyboard.print("You pressed the button ");
     ^~~~~~~~
exit status 1

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

Despite the Library being included. I haven't changed the code, tried " " and <>, Sketchbook location is defined properly, and using the full path to the file.

Has anyone had problems with that?

IDE Version 2.3.8

reddit.com
u/DerKnoedel — 13 hours ago