04-12-2020, 02:53 PM
(This post was last modified: 04-12-2020, 02:53 PM by Tim Curtis.)
That would suggest the code is not detecting any change in the pin state. Below is the code block for button 1.
Pin numbering used is SoC.
https://raspi.tv/2013/rpi-gpio-basics-4-...and-inputs
Code:
if str(row['id']) == '1' and row['enabled'] == '1':
sw_1_pin = int(row['pin'])
sw_1_cmd = row['command'].split(',')
sw_1_cmd = [x.strip() for x in sw_1_cmd]
GPIO.setup(sw_1_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def sw_1_event(channel):
subprocess.call(sw_1_cmd)
GPIO.add_event_detect(sw_1_pin,
GPIO.RISING,
callback=sw_1_event,
bouncetime=bounce_time)
print(str(datetime.datetime.now())[:19] + ' sw_1: pin=' +
str(sw_1_pin) + ', enabled=' + row['enabled'] +
', bounce_time=' + str(bounce_time) + ', cmd=' + row['command'])
Pin numbering used is SoC.
https://raspi.tv/2013/rpi-gpio-basics-4-...and-inputs
Code:
# Use SoC pin numbering
GPIO.setmode(GPIO.BCM)