arduino-libraries / Keyboard

GNU Lesser General Public License v3.0
225 stars 158 forks source link

Issues with the library #70

Closed skhrlx closed 2 years ago

skhrlx commented 2 years ago

Basically, when i run this sketch into my arduino, he just write "=", he dont write "a".

I just already tried:

Modify "a" in >KeyboardLayout.cpp using the key code given for me at https://keycode.info/, and the arduino continue writing "=" I tried run it in a Windows 10 and Ubuntu 20.04 and i got the same issue *I tried other default layout, es_ES, return a ")"

I use the ABNT 2 Keyboard Layout(brazilian layout...)

I just trying to make this work like 6 hours, i just dont know what i can do more...apreciate any response

#include <Keyboard.h>

void setup() {
  Serial.begin(9600);
  Keyboard.begin();
}

void loop() {
  Keyboard.write("a");
  delay(5000);
}
edgar-bonet commented 2 years ago

According to the manual page of Keyboard.write(), the provided argument should be:

a char or int to be sent to the computer. Can be sent in any notation that’s acceptable for a char.

You can thus use

Keyboard.write('a');  // 'a' is a char

If you want to send a string of characters, like "a" (double quotes mean “string”), you should use Keyboard.print() instead.

Given that the correct usage is documented, I would consider this issue invalid.