Skip to content

Leonardo keyboard API only allows ASCII input #1386

Closed
@yahesh

Description

@yahesh

The Arduino Leonardo keyboard API only allows ASCII input and then converts it to the actual key codes sent to the computer via USB. This is a huge problem because it fails for non-QWERTY systems (e.g. in Germany, France) and even for non-Windows systems (e.g. when it comes to special characters on a Mac).

Take this code as a small example. On a German computer this will actually output "qwerty".

void setup() {
  Keyboard.begin();

  pinMode(2, INPUT);
  digitalWrite(2, HIGH);
}

void loop() {
  while (digitalRead(2) == HIGH) {
    delay(500);
  }
  delay(1000);

  Keyboard.print("qwertz");
}

It would be great to have something like Keyboard.pressKeycode() and Keyboard.releaseKeycode() and actually do the conversions ourselves. That way we could ask the user what keyboard layout he/she has and do everything appropriately.

Metadata

Metadata

Assignees

Labels

Component: CoreRelated to the code for the standard Arduino APIType: Bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions