Key Presses in Games

All other Source.Python topics and issues.
Junior Member
Posts: 1
Joined: Fri Nov 26, 2021 11:56 am

Key Presses in Games

Postby Ape_Devil » Fri Nov 26, 2021 12:04 pm

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.

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!

Syntax: Select all

from pyfirmata import Arduino, util
from pynput.keyboard import Key, Controller
import time

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

iterator = util.Iterator(board)

keyboard = Controller()

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 =',
# time.sleep(.1)

if < 0.4:'s')

if > 0.6:'w')

if < 0.4:'a')

if > 0.6:'d')

Junior Member
Posts: 5
Joined: Tue Sep 21, 2021 12:13 pm
Location: Russia

Wrong forum

Postby Articha » Fri Nov 26, 2021 6:26 pm

This is forum to discuss Source.Python, addon for Source-based (by Valve) games. Your question are not related to this topic

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest