I am using 24pin and 26pin. The 24pin trigger 3 times with 26pin. The code is bollow.
But I find when both of they triggered , start time not equal. About 150us diffent.
Is there any way to fix that ?
import RPi.GPIO as GPIO
fast_pin = 24
slow_pin = 26
GPIO.setup(fast_pin, GPIO.OUT, initial=GPIO.HIGH)
GPIO.setup(slow_pin, GPIO.OUT, initial=GPIO.HIGH)
curr_value = GPIO.HIGH
print("Starting demo now! Press CTRL+C to exit") count_dn = 0 count_up = 0 try: while True: time.sleep(0.015) if(count_up % 3 == 0 and curr_value == GPIO.HIGH): GPIO.output(slow_pin, curr_value) elif(count_dn % 3 == 0 and curr_value != GPIO.HIGH): GPIO.output(slow_pin, curr_value) GPIO.output(fast_pin, curr_value) if curr_value == GPIO.HIGH: count_up += 1 else: count_dn += 1 curr_value ^= GPIO.HIGH finally: GPIO.cleanup()
if name == ‘main’: