Connecting a custom Arduino-based controller

Welcome Page Forums RetroPie Project Everything else related to the RetroPie Project Connecting a custom Arduino-based controller

This topic contains 0 replies, has 1 voice, and was last updated by  kera1492 2 years, 10 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #85352

    kera1492
    Participant

    Hello,
    first of all thank you for all the fantastic work on RetroPie! It inspired me to do my own retro-game station. As a controller I’d like to use Arduino UNO with a Joystick Shield – just like one attached. Using RetroPie 2.3 + Raspberry B.
    I connect Arduino to Raspberry via USB cable. Some code polls the status of keys out from Arduino to Raspberry. Raspberry collects the data from the serial /dev/ttyUSB0 to decide what actions to take. I’ve managed to inject the keys using some python code like (parts ommited for clarity, found somewhere – don’t have author’s name, sorry for that):

    
    from evdev import uinput, ecodes as e
    EV_KEYUP = 0
    EV_KEYDOWN = 1
    def pressAkey(key):
        ui.write(e.EV_KEY, key, EV_KEYDOWN)
        sleep(.1)
        ui.write(e.EV_KEY, key, EV_KEYUP)
        ui.syn()
    ui = uinput.UInput()
    pressAkey(e.KEY_LEFT)
    

    Under EmulationStation (ES) works like a charm. I can control ES using shield’s joystick and buttons.
    But when I enter any game (Duke Nukem, Doom), my Arduino-controller stops working…
    I understand that I’m missing some linux<>emulator configuration… Could you please point me to direction?
    (sorry if this is duplicate, but I’m new to the subject and some parts are mysterious for me, could not find anything appropriate).

    Thanks in advance!
    Regards.

    Attachments:
Viewing 1 post (of 1 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/