Skip to content

Instantly share code, notes, and snippets.

@cyrusn
Created April 13, 2018 08:07
Show Gist options
  • Save cyrusn/f3e75a7ee1195883015063be3e07c4c7 to your computer and use it in GitHub Desktop.
Save cyrusn/f3e75a7ee1195883015063be3e07c4c7 to your computer and use it in GitHub Desktop.
Control IR cut for IR cut camera
# https://www.waveshare.com/rpi-ir-cut-camera.htm
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
LDR_PIN = 11
POWER_SUPPLY = 13
GPIO.setup(LDR_PIN, GPIO.IN)
GPIO.setup(POWER_SUPPLY, GPIO.OUT)
try:
while True:
if GPIO.input(LDR_PIN):
GPIO.output(POWER_SUPPLY, GPIO.LOW)
else:
GPIO.output(POWER_SUPPLY, GPIO.HIGH)
sleep(0.1)
finally:
print("Programme Quit")
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment