Created
April 13, 2018 08:07
-
-
Save cyrusn/f3e75a7ee1195883015063be3e07c4c7 to your computer and use it in GitHub Desktop.
Control IR cut for IR cut camera
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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