Jul-31-2020, 09:57 PM
I am using python inputs library to detect gamepad button presses.
Purpose: I want to change the listening mode of my Pioneer AV-Receiver when pressing RB on my Xbox Controller. The event is logged as 'BTN_TR' through python inputs library.
Right now when I press the button it loops through all added listening modes when I press RB once. (as expected) but that's not what I want. I want to change from one listening mode to the next each time I press RB.
So when I press RB for the first time it should switch from Auto Surround to Rock/Pop. When I press RB again it should switch to Ext.Stereo. And the third time I press RB it should switch back to Auto Surround.
This is my code right now. What do I need to change?
Purpose: I want to change the listening mode of my Pioneer AV-Receiver when pressing RB on my Xbox Controller. The event is logged as 'BTN_TR' through python inputs library.
Right now when I press the button it loops through all added listening modes when I press RB once. (as expected) but that's not what I want. I want to change from one listening mode to the next each time I press RB.
So when I press RB for the first time it should switch from Auto Surround to Rock/Pop. When I press RB again it should switch to Ext.Stereo. And the third time I press RB it should switch back to Auto Surround.
This is my code right now. What do I need to change?
def main():
while 1:
events = get_gamepad()
for event in events:
lmd_query = eiscp.eISCP('192.168.0.59').raw('LMDQSTN')
if lmd_query == 'LMD80': #autosurround
if event.code == 'BTN_TR':
eiscp.eISCP('192.168.0.59').raw('LMD06') #rockpop
if lmd_query == 'LMD06':
if event.code == 'BTN_TR':
eiscp.eISCP('192.168.0.59').raw('LMD0C') #ext.stereo
if lmd_query == 'LMD0C':
if event.code == 'BTN_TR':
eiscp.eISCP('192.168.0.59').raw('LMD80')
if __name__ == "__main__":
main()Thank you for reading and if you have an idea please let me know!
