Wrong characters when using HID interface

Hi, I'm using the new Arduino R4 WiFi, I've been experimenting with the hid library(Keyboard) and I've noticed that some characters aren't correct.
As example if i use this program

#include <Keyboard.h>

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

void loop() {
  Keyboard.press('+');
  Keyboard.releaseAll();
  delay(1000);
}

Instead of typing '+', Arduino types '^'. Does anyone knows why I'm not getting the correct character?

are you using a US layout keyboard on your computer ?

1 Like

No, I'm using an Italian keyboard

use/send/write key codes instead of symbols

Keyboard.write(KEY_KPPLUS );

you may try:
Keyboard.write('+');
Keyboard.print('+');

Secret HID Scancodes

hidden

so that's the issue. The library sends codes that map to an US QWERTY keyboard.

you could double check this doc and

1 Like

Ok, now it works. I had to open the Keyboard.cpp file and replacing the array content with the italian version and defining the ALT_GR key as 0xc0.
Thank you for your help

great - have fun

1 Like