MichaelDworkin / KeyboardMultiLanguage

14 stars 2 forks source link

some chars `<>|` in /examples/KeyboardGerman not printing #1

Open HerrZatacke opened 5 years ago

HerrZatacke commented 5 years ago

Hi,

Thanks! First of all, I have to say thanks for providing the community with this library! It works out of the box for me without much of a C/Arduino background.

I've just experienced issues with these few characters: <>|

My Code: I've been testing this with a simple echo script which "types" what's been received over the serial port.

#include <KeyboardMultiLanguage.h>
#include "KeyboardMappingGE.h"

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

void loop() {
  while (Serial.available() > 0) {
    Keyboard.write(Serial.read());
  }
}

Modifying the line in the Example to Keyboard.println("Ich kann Glas essen, ohne mir <zu>| schaden."); also produces not the expected "typed" chars.

MichaelDworkin commented 5 years ago

Hi, You're right. This is a mistake. I have information about HID scan code from here https://www.heise.de/ct/artikel/HID-Tastatur-Scanncodes-3150880.html this button is not mentioned as a sign. the key "<> |" has scan code 100 (0x64) and is not recorded at all. I'll work on that. until then please use Keyboard.press(100 + 136); Keyboard.release(100 + 136); to press this button

Sie haben recht. Das ist ein Fehler. Ich habe Information über HID Scankode von hier https://www.heise.de/ct/artikel/HID-Tastatur-Scanncodes-3150880.html Da ist diese Taste nicht als Zeichen erwähnt. Die Taste "<>|" hat Scankode 100 (0x64) und wird gar nicht aufgezeichnet. Ich werde daran arbeiten. bis dahin bitte benutzen Sie Keyboard.press(100+136); Keyboard.release(100 + 136) um diese taste zu betätigen

HerrZatacke commented 5 years ago

Hi,

Awesome!

After figuring out the modifiers, my code now looks like this and it works:

#include <KeyboardMultiLanguage.h>
#include "KeyboardMappingGE.h"

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

void loop() {
while (Serial.available() > 0) {
    c = Serial.read();
    switch (c) {
      case '<':
        Keyboard.press(236);
        Keyboard.release(236);
        break;
      case '>':
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.press(236);
        Keyboard.release(236);
        Keyboard.release(KEY_LEFT_SHIFT);
        break;
      case '|':
        Keyboard.press(KEY_RIGHT_ALT);
        Keyboard.press(236);
        Keyboard.release(236);
        Keyboard.release(KEY_RIGHT_ALT);
        break;
      default:
        Keyboard.write(c);
    }
  }
}

I'll still watch out for an update so that I can remove this workaround later.

MichaelDworkin commented 5 years ago

hi i have also corrected the library. this button is now included in all languages. Download the library again