From d0fd9a0c944c2cd385954faf2d885c297e1a09df Mon Sep 17 00:00:00 2001 From: Ben Nicholson Date: Sat, 15 Nov 2025 07:40:54 +1100 Subject: [PATCH] change from push and release operation to just push --- ras_pi_RRCS_BusyLight.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/ras_pi_RRCS_BusyLight.py b/ras_pi_RRCS_BusyLight.py index 99227a6..0bac1a7 100644 --- a/ras_pi_RRCS_BusyLight.py +++ b/ras_pi_RRCS_BusyLight.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 import os os.environ['RPI_LGPIO_REVISION'] = "800012" - +import time import requests import RPi.GPIO as GPIO @@ -49,25 +49,14 @@ BenBusyRRCSdataFalling = ''' def button_callback(channel): if GPIO.input(channel): print(f"{RED}Button pressed{RESET}") - r = requests.post( - 'http://10.75.120.229:8193', - headers={'content-type': 'text/xml'}, - data=BenBusyRRCSdataRising - ) - else: + r = requests.post('http://10.75.120.229:8193',headers={'content-type': 'text/xml'},data=BenBusyRRCSdataRising) + time.sleep(0.05) print(f"{GREEN}Button released{RESET}") - r = requests.post( - 'http://10.75.120.229:8193', - headers={'content-type': 'text/xml'}, - data=BenBusyRRCSdataFalling - ) - print(r.text) - + r = requests.post('http://10.75.120.229:8193',headers={'content-type': 'text/xml'},data=BenBusyRRCSdataFalling) GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) -# One event detector, both edges: GPIO.add_event_detect(12, GPIO.BOTH, callback=button_callback, bouncetime=200) input("Press enter to quit\n\n")