Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: Kxno on October 16, 2019, 01:58:17 pm

Title: Arduino attiny85 keyboard
Post by: Kxno on October 16, 2019, 01:58:17 pm
Hello,

Everything is working perfect but i have azerty keyboard on my laptop, when i plug it in it just types as qwerty.
How can i change my sketch that it does it work on azerty?

Thanks,
Kxno
Title: Re: Arduino attiny85 keyboard
Post by: granzeier on October 17, 2019, 03:38:28 am
It appears that the scan code is based on which physical key (by location on the keyboard) is pressed. The thread at: https://stackoverflow.com/questions/38058419/is-scan-code-the-same-on-all-keyboards shows the physical key layout, with the scan codes, and then shows the layout for both the QWERTY, and the AZERTY keyboards. What you will need to do is to look up the letter that you want (for example the Q) and the find the scan code on the key which is physically in the same position (17 for the QWERTY, but 31 for the AZERTY keyboards.)

This scan code table appears to be in decimal, which is what the sendKeyStroke statement uses. So, you would want to use something like:
Code: [Select]
DigiKeyboard.sendKeyStroke(31);
Try that, and see if it does what you want. If not, try searching for other keyboard scan code tables, and see if one of them will work.

This should work for any keyboard layout (you will need to locate the letter you want on the scan code layout, and use that code.) Otherwise you could modify the DigiKeyboard.h library (https://github.com/digistump/DigisparkArduinoIntegration/blob/master/libraries/DigisparkKeyboard/DigiKeyboard.h,) then you could use any of the DigiKeyboard commands, and not just the sendKeyStroke command.