Why doesent it work

grafik
it shoud work right bc the Keyboard.h is incloudet

By "doesn't work", do you mean "doesn't compile"?
Like, maybe you've tried to compile for the wrong processor?

Please do not post pictures of code, particularly when it is only a snippet of the whole sketch

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

1 Like

Please don't use chat speak here. It's an international forum and also it's important to be very clear because it's a technical subject.

3 Likes

incloudet

What is that?

What Arduino are you using? The Keyboard library only works with processors with native USB (Leonardo, Micro).

From the Keyboard library reference.

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

Images of code are not very useful. Please read the forum guidelines to see how to properly post code and some information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in a code block.

Snippets of code often leave out much important information. Post the whole code or a minimal verifiable example. >> How to create a Minimal, Reproducible Example - Help Center - Stack Overflow

iam usng a one r3

Uno R3 does not have native USB so will not work with the Keyboard library.

"included" ?

1 Like

Native usb isnt the pc port? Then what is? Does that apply to the mega2560?

No, boards/processors such as 32u4, SAMD21, Teensy 3.x, etc.

Does not have a native USB port either.

Btw if i showed you all of the code i woudh have had a problem!

Cool, cool. Good to know.

No - that's just a UART-to-USB converter on the Uno

The Library documentation does say this:

I don't think so.
A posting can hold 120.000 characters. Which equals to 117 kB of code.
Or is the "problem" that you are not allowed to ask in public forums?

If you explain the final purpose of sending the keystrokes
work-arounds using an arduino Uno can be suggested.
A python-code or an autohotkey-script could receive the serial data and create keystrokes etc.

best regards Stefan

"Native USB" means that the main microcontroller provides the USB functionality. So any board that has a dedicated chip (16U2, FTDI, CH340) for the communication does not have native USB.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.