From 4a76764f51523e425cf4d1f750985955421fcd91 Mon Sep 17 00:00:00 2001 From: Ben Nicholson Date: Mon, 10 Nov 2025 15:45:25 +1100 Subject: [PATCH] Upload files to "/" --- ras_pi_RRCS_BusyLight.py | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 ras_pi_RRCS_BusyLight.py diff --git a/ras_pi_RRCS_BusyLight.py b/ras_pi_RRCS_BusyLight.py new file mode 100644 index 0000000..6395bb8 --- /dev/null +++ b/ras_pi_RRCS_BusyLight.py @@ -0,0 +1,63 @@ +#!/usr/bin/python3 +import os +os.environ['RPI_LGPIO_REVISION'] = "800012" +import requests +import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library + +BenBusyRRCSdataRising = ''' + + PressKeyEx + + C0000000001 + 64 + 46 + 0 + 2 + 0 + 1 + 1 + 1 + 1 + + +''' + +BenBusyRRCSdataFalling = ''' + + PressKeyEx + + C0000000002 + 64 + 46 + 0 + 2 + 0 + 1 + 1 + 0 + 1 + + +''' + +def button_callbackRising(channel): + print("Button was pushed!") + r = requests.post('http://10.75.120.229:8193', headers = {'content-type': 'text/xml'}, data = BenBusyRRCSdataRising) + print (r.text) + +def button_callbackFalling(channel): + print("Button was Released!") + r = requests.post('http://10.75.120.229:8193', headers = {'content-type': 'text/xml'}, data = BenBusyRRCSdataFalling) + print (r.text) + +GPIO.setwarnings(False) # Ignore warning for now +GPIO.setmode(GPIO.BOARD) # Use physical pin numbering +GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # Set pin 10 to be an input pin and set initial value to be pulle> + +GPIO.add_event_detect(12,GPIO.RISING,callback=button_callbackRising) # Setup event on pin 10 rising edge + +GPIO.add_event_detect(12,GPIO.FALLING,callback=button_callbackFalling) + +message = input("Press enter to quit\n\n") # Run until someone presses enter + +GPIO.cleanup() # Clean up