Skip to content

Instantly share code, notes, and snippets.

@dobrienSTJ
Forked from MrDMurray/light.py
Created December 6, 2016 10:03
Show Gist options
  • Save dobrienSTJ/79464e3d38510cc127fcd70e0db2cdec to your computer and use it in GitHub Desktop.
Save dobrienSTJ/79464e3d38510cc127fcd70e0db2cdec to your computer and use it in GitHub Desktop.
STJLOL-DMU Basic GPIO
#the setup
import RPi.GPIO as GPIO #lets you use GPIO
from time import sleep #lets you use sleep(2) as a timer for the lights
GPIO.setmode(GPIO.BOARD) #tells the program what labeling system to use
GPIO.setup(17, GPIO.OUT) #tells the pi exactly what number pin you'll be using
#the code
GPIO.output(17, GPIO.HIGH) #tells the pi to turn on this pin
sleep(2) #waits 2 seconds
GPIO.output(17, GPIO.LOW) #tells the pi to turn off this pin
#the cleanup
GPIO.cleanup() #shuts down all GPIO stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment