Following ame's suggestions, here is how I've wired my C-mount switchable IR-cut filter.
and with this test code it's switching between states quite reliably.Code:
#!/usr/bin/python3import RPi.GPIO as GPIOfrom time import sleepGPIO.setmode(GPIO.BCM)Driver1 = 5Driver2 = 6Enable = 26Pulsewidth=.1Delay =2Cycles =0GPIO.setup(Driver1,GPIO.OUT)GPIO.setup(Driver2,GPIO.OUT)GPIO.setup(Enable,GPIO.OUT)def PulseEnable(): GPIO.output(Enable,GPIO.HIGH) sleep(Pulsewidth) GPIO.output(Enable,GPIO.LOW)while Cycles <5: print ("Filter IR-out") GPIO.output(Driver1,GPIO.HIGH) GPIO.output(Driver2,GPIO.LOW) PulseEnable() sleep(Delay) print("Filter IR-in") GPIO.output(Driver1,GPIO.LOW) GPIO.output(Driver2,GPIO.HIGH) PulseEnable() sleep(Delay) Cycles += 1print ("Set all pins low and tidy up")GPIO.output(Driver1,GPIO.LOW)GPIO.output(Driver2,GPIO.LOW)GPIO.output(Enable,GPIO.LOW)GPIO.cleanup()
Statistics: Posted by sandyol — Fri Mar 15, 2024 9:56 pm