0

I use Arduino Leonardo board for virtual keyboard. Everything work fine, but when my local keyboard layout is russian it's not work how I want. This is my code

Keyboard.print("cmd");
typeKey(KEY_RETURN);
delay(2000);
Keyboard.print("powershell iwr -outf %TEMP%\\index.html http://google.com");
typeKey(KEY_RETURN);

Otput in English US keyboard layout:

cmd
powershell iwr -outf %TEMP%\index.html http://google.com

Output in Russian keyboard layout

сьв
зщцукырудд шцк -щгеа %ЕУЬЗ%\штвучюреьд реезЖ..пщщпдуюсщь

Is there a way to make Arduino Leonardo to write every time in English US keyboard layout no matter what keyboard layout uses my computer?

  • 1
    This is not really an Arduino question. This is a Windows operating systems question about switching between keyboard layouts. Should be close this question? Or ask to have it moved to a more appropriate forum? – st2000 Oct 8 '17 at 17:11
2

The Arduino Leonardo, in the same way as any keyboard, just sends keystroke data. It is down to your computer's operating system to translate those into individual letters and symbols. The Leonardo (and indeed any keyboard) has no say over how the operating system does that translation.

A brief google search (which led back to Stack Exchange) found me this project which may be of some interest. It allows you to automatically change the selected keyboard language depending on which keyboard is being used at any one moment in time.

  • But how to add this in Arduino Leonardo ? – Desole Oct 8 '17 at 16:17
  • 1
    You didn't quite grasp what I said, did you? It's down to your operating system which is windows, and that is where you have to do everything. – Majenko Oct 8 '17 at 16:19
  • I understand you. But if I want to test arduino leonardo keyboard on different pc with russian layout I have to download this and use them. I want to configure Arduino to send keystrokes everytime in US layout in every pc no matter which keyboard layout they uses. – Desole Oct 8 '17 at 16:35
  • 1
    @Desole you don't send keystrokes in any layout. You send keystrokes that, to a certain extent, describe the physical location of the key on they keyboard. There is no language. Only a location. Only the operating system can convert that location to a character. There is nothing you can do from the Arduino. No matter how much you beg and moan. – Majenko Oct 8 '17 at 16:38
  • Think about it: if the keyboard could define the layout why would the operating system even have the ability to select a layout? It'd be pointless. Keycodes do not equate to characters directly. True, a Unicode keyboard is technically possible, but no operating system supports such a thing because there is no standard for it. – Majenko Oct 8 '17 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.