Help with Network Commands



  • Hello Recalbox team and fans,

    I'm having some difficulties understanding how to use the Emulator Actions via GPIO (https://github.com/recalbox/recalbox-os/wiki/Emulator-interactions-via-GPIO-mapping-(EN)) guide.

    I have 3 arcade buttons that I would like to map to fast-forward, pause, and reset, respectively. I see the script in the link, but I'm not 100% on how to rebuild it to allow me to use 3 different buttons. What parts of the original script do I need to cut and paste? I would use BCM 17, 27 & 22

    original script here:
    import RPi.GPIO as GPIO
    import time
    import socket

    addressing information of target

    IPADDR = "127.0.0.1"
    PORTNUM = 55355

    enter the data content of the UDP packet

    COMMAND = "RESET"

    initialize a socket, think of it as a cable

    SOCK_DGRAM specifies that this is UDP

    try:
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    except socket.error:
    print 'Failed to create socket'
    sys.exit()
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    def exitEmulator(channel):
    s.sendto(COMMAND, (IPADDR, PORTNUM))
    GPIO.add_event_detect(3, GPIO.FALLING, callback=exitEmulator, bouncetime=500)
    while True:
    time.sleep(10)

    Thank you for the help!



Want to support us ?

Join us on :

175
Online

28871
Users

14654
Topics

110766
Posts

Looks like your connection to Recalbox Forum was lost, please wait while we try to reconnect.