07-07-2021, 02:55 PM
I would like to use a rotary switch to select playlists on one of my moOde players. I've got scripts mapped to the GPIO button handler that load and play the playlists as I need, but because the script attached to the button fires when the button disconnects my rotary switch will play the playlist attached to the position it just left, not the one for the position it is in.
Is there a way to get the buttons to run the attached scripts when the contact is made, rather than when the contact is broken?
Is it as simple as:
becoming
in the gpio-buttons.py
Is there a way to get the buttons to run the attached scripts when the contact is made, rather than when the contact is broken?
Is it as simple as:
Code:
GPIO.add_event_detect(sw_1_pin, GPIO.RISING, callback=sw_1_event, bouncetime=bounce_time)
Code:
GPIO.add_event_detect(sw_1_pin, GPIO.FALLING, callback=sw_1_event, bouncetime=bounce_time)
----------------
Robert
Robert