The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


GPIO buttons that fire on connect.
#1
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:

Code:
GPIO.add_event_detect(sw_1_pin, GPIO.RISING, callback=sw_1_event, bouncetime=bounce_time)
becoming

Code:
GPIO.add_event_detect(sw_1_pin, GPIO.FALLING, callback=sw_1_event, bouncetime=bounce_time)
in the gpio-buttons.py
----------------
Robert
Reply


Messages In This Thread
GPIO buttons that fire on connect. - by the_bertrum - 07-07-2021, 02:55 PM

Forum Jump: