Skip to content

Instantly share code, notes, and snippets.

@nilsmagnus
Created August 8, 2013 18:35
Show Gist options
  • Save nilsmagnus/6187386 to your computer and use it in GitHub Desktop.
Save nilsmagnus/6187386 to your computer and use it in GitHub Desktop.
raspi irsensor
import time
import subprocess
import RPi.GPIO as io
io.setmode(io.BCM)
pir_pin = 18
io.setup(pir_pin, io.IN) # activate input
while True:
if io.input(pir_pin):
print("PIR ALARM!")
subprocess.call(["./takeapic.sh"])
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment