techpaul / PS2KeyMap

Arduino PS2 keyboard International Keyboard mapping from PS2KeyAdvanced and return as UTF-8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples not working

jfoucher opened this issue · comments

I have successfully connected my PS2 keyboard to an Arduino Nano. I get the correct keycodes in the serial monitor. However setting a keymap never works. In both of the provided examples, everything looks ok, except for changing the keymap.

In https://github.com/techpaul/PS2KeyMap/blob/master/examples/International/International.ino I have added the following code at line 146 :

Serial.println("Trying to switch to french");
found = keymap.selectMap( (char *)"FR" );
if (found) {
    Serial.println("Success");
}
else {
    Serial.println("Failed");
}

But the only things I get in the serial monitor are as follows :

PS2KeyMap plus PS2KeyAdvanced Libraries
International Keyboard Test:
Default is US layout, type a key to change layout
 U for US     G for GB/UK
 D for DE     F for FR
 I for IT     E for ES
 All keys on keyboard echoed here
Value 44 mapped 64 - Status Bits 0  Code 64  ( d )
Value 46 mapped 66 - Status Bits 0  Code 66  ( f )
Trying to switch to french
Failed
Value 44 mapped 64 - Status Bits 0  Code 64  ( d )
Value 46 mapped 66 - Status Bits 0  Code 66  ( f )
Trying to switch to french
Failed

Would you have a hint as to what I might be doing wrong ?
thanks

Basic keyboard handling is correct (getting the keycodes)

Something else is wrong as when you use the 'd' key it should switch to German first and give response of

"Keyboard set to DE"

Followed by after 'f' key

"Keyboard set to FR"

As it does when I test on other boards, as this is AVR style board I suspect a compilation error not placing things in correct Flash memory but will check again tomorrow when I have time.

I am using a chinese arduino nano clone, specifically this one : https://www.aliexpress.com/item/32807227857.html

Checking through files and history has found the error added during last update V1.0.6 will be available soon and fix the problem.

V1.0.6 released here may need to wait for Arduino next update time for Library Manager to collect from there