Trouble with libarys:

I have a problem:
Even if i write in my code on the top "#include <Keyboard.h>" nothing happens and the programm tells me:'Keyboard' nicht gefunden. Beinhaltet Ihr Sketch die Zeile '#include <Keyboard.h>'?
Keyboard not found.

The real strange thing is:
When I use the code promoted on this website to use the Keyboard libar, it does not work. The Uploading is not the problem. It is the translation.
MFG
Kasten
PS: sorry for my bad englisch I am working on this :slight_smile:

Which device are you compiling for?

What do you mean? I am using Windows and the Ardoino Ide software.

Have you installed the library? Try to install it from the menubar. Click sketch, then include library, and then click manage library. After that, try to search keyboard and install it.

Does it works?

AWOL means which Arduino board (Uno, Mega, Leonardo, Micro, Nano, etc.)?

When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).

I installed the libary AND I tryed it with a uno and a nano board

How about compiling it for a board where you would expect Keyboard.h to work?

I already did this with an arduino uno

Does this help?

Thank you but no I just tried it. :frowning:

#include <HID.h>
#include <Keyboard.h>

int modePin = 2;
int onPin = 3;

void setup() {
pinMode(INPUT, modePin);
pinMode(OUTPUT, onPin);
pinMode(LED_BUILTIN, OUTPUT);

digitalWrite(onPin, HIGH);

Keyboard.begin();
}

void loop() {
if(digitalRead(modePin)==HIGH){
digitalWrite(LED_BUILTIN, HIGH);
//execute input code
//Keyboard.write('Hallo Welt!');
//end execution
}else{
digitalWrite(LED_BUILTIN, LOW);
}
}

that is the code that does not work :frowning:

Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\User\Documents\Arduino\rotaryEncoderPoti\projekte\usb_cracking\usb_cracking.ino:2:0:

C:\Users\User\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:\Users\User\Documents\Arduino\rotaryEncoderPoti\projekte\usb_cracking\usb_cracking.ino: In function 'void setup()':

usb_cracking:14: error: 'Keyboard' nicht gefunden. Beinhaltet Ihr Sketch die Zeile '#include <Keyboard.h>'?
Keyboard.begin();

^

Mehrere Bibliotheken wurden für "Keyboard.h" gefunden
Benutzt: C:\Users\User\Documents\Arduino\libraries\Keyboard
Nicht benutzt: C:\Program Files (x86)\Arduino\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.

and this the error massage (in German...)

Ok, one more time.
What happens when you compile for, say, a Leonardo?

From the link that AWOL posted

Keyboard Library for Arduino

This library allows an Arduino board with USB capabilites to act as a Keyboard. Being based on HID library you need to include "HID.h" in your sketch.

The Uno does not have these capabilities.

Ok, thank you guys, this was the problem. I can´t use the standard Keyboard libary for an arduino nano. Thank you very much.
Now I can start to find a libary that works with arduino nano. MF Kasten

You will need to spend time on finding a board that can act as a HID.

An Uno can be modified to act as a HID by reprogramming the 16U2. I don't have the schematic of a Nano in my head so not sure if it has the 16U2 as well; if it's using a fdti chip or ch340, you're out of options.