From d70c305626952763ccdd38e7e8f0b268be62d60e Mon Sep 17 00:00:00 2001 From: frank Date: Fri, 4 Nov 2022 21:05:26 -0400 Subject: [PATCH] force small delay between gpio connection comparisons --- gpio.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gpio.py b/gpio.py index 55add18..93a1e8b 100644 --- a/gpio.py +++ b/gpio.py @@ -52,6 +52,9 @@ def connection2(pin_a, pin_b): # Set all other pins to input pullup GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) + # Force 25ns delay between comparisons + time.sleep(0.025) + # pin_b can now be tested to see if if reads the LOW signal from pin_a return GPIO.input(pin_b) == GPIO.LOW @@ -104,9 +107,8 @@ if __name__ == "__main__": while True: # Try all connections once each frame - for connection_ids, connection_state in connections(): + for connection_ids, connection_state in connections().items(): # Only print connected combinations of pins if connection_state: pin_id_a, pin_id_b = connection_ids print(f"{pin_id_a} ({pins[pin_id_a]}) <-> {pin_id_b} ({pins[pin_id_b]})") - time.sleep(0.1)