keyboard with arduino and python (doest work in games)

hey guys!

I am building something like a splitkeyboard / joystick-controller for pc. The brain of the project is an arduino pro micro. I am using it in combination with firmata and python.

I decided to use python because i wanna have more than on setup / layout, for each programm it’s own layout.
For example I would like to have a layout for blender, inkscape or for gaming, but one layout for each game or program.

I tried to do it with pyautogui, pynput it’s working in general but not for games. It has something to do with directinput as far I can tell.

Do you have any advice how I can fix it so it also works in games?
By the way, I am using linux but I would like to have a cross platform solution.

Thanks for the Help!

code example:

from pyfirmata import Arduino, util
import pyautogui

import time

    board = Arduino('/dev/ttyACM0')
    print('----------------faild to connect')

iterator = util.Iterator(board)

x = board.get_pin('a:0:i')
y = board.get_pin('a:1:i')
s = board.get_pin('d:10:i')


while True:
    print('x =',
    print('y =',
    print('s =',

    if < 0.4:'s')

    if > 0.6:'w')

    if < 0.4:'d')

    if > 0.6:'a')

I cannot say much, but I know a friend of mine has some issues with game-inputs on PC (he is left handed and not all games offer native support).
And games tend to have different approaches on getting inputs. As they are usually written in low-level languages (C or C++), they can directly interact with the hardware and he mentioned some games that literally observe hardware inputs - which you cannot modify unless you physically change the hardware itself.

That’s all I can say for that. But yeah, games can be super resource heavy hence they are optimized in ways other programs are not and this includes working closer with the hardware and as such making it harder to interrupt their behavior.

1 Like

cheers for the answer!
i think it also has something to do with cheating too

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.