Skip to content

Instantly share code, notes, and snippets.

@dobrienSTJ
Forked from MrDMurray/sensory.py
Created March 7, 2017 10:10
Show Gist options
  • Save dobrienSTJ/2f5f9f10eae0f1e8c6f3275e6e644286 to your computer and use it in GitHub Desktop.
Save dobrienSTJ/2f5f9f10eae0f1e8c6f3275e6e644286 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