Skip to content

Instantly share code, notes, and snippets.

@MrDMurray
Created March 1, 2017 23:00
Show Gist options
  • Save MrDMurray/c956356409e39cc9f72b6e8a6b081bd8 to your computer and use it in GitHub Desktop.
Save MrDMurray/c956356409e39cc9f72b6e8a6b081bd8 to your computer and use it in GitHub Desktop.
STJLOL Sensory
import RPi.GPIO as GPIO
from time import sleep
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
#this was the setup
while True:
sensor=GPIO.input(17) #this reads from the sensor
if sensor==1: #this means there is no signal
print("I SEE NAAAAAA'N)
sleep(0.1)
elif sensor==0: #this means there is a signal
print("OH LOOOOOOK! IT'S A SOMETHING!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment