Skip to content

Instantly share code, notes, and snippets.

@parsons-Jsr
Created November 23, 2012 10:21
Show Gist options
  • Save parsons-Jsr/4134921 to your computer and use it in GitHub Desktop.
Save parsons-Jsr/4134921 to your computer and use it in GitHub Desktop.
Raspberry Pi: Python script that activate LED on sensor detection (by JSRP)
import RPi.GPIO as GPIO
from time inport sleep
GPIO.setmode (GPIO.BOARD)
GPIO.Setup (7, GPIO.IN)
GPIO.Setup (11, GPIO.OUT)
while 1:
if GPIO.input(7):
GPIO.output(11, False)
else:
GPIO.output(11, True)
Sleep(0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment