Created
March 1, 2017 23:00
-
-
Save MrDMurray/c956356409e39cc9f72b6e8a6b081bd8 to your computer and use it in GitHub Desktop.
STJLOL Sensory
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
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