Skip to content

Instantly share code, notes, and snippets.

@daniel-obrien
Forked from MrDMurray/gpioNB.py
Created January 10, 2017 10:40
Show Gist options
  • Save daniel-obrien/090fc384da115e34218f6024dd8fc8d3 to your computer and use it in GitHub Desktop.
Save daniel-obrien/090fc384da115e34218f6024dd8fc8d3 to your computer and use it in GitHub Desktop.
STJLOL GPIO essential code
#the setup
import RPi.GPIO as GPIO #lets you use GPIO
from time import sleep
GPIO.setmode(GPIO.BCM) #tells the program what labeling system to use. Use BCM.
GPIO.setup(23, GPIO.OUT) #tells the pi exactly what number pin you'll be using eg. 23
#the code
GPIO.output(23, GPIO.HIGH) #tells the pi to turn on this pin eg.23 turns on
sleep(1)
GPIO.output(23, GPIO.LOW) #tells the pi to turn off this pin eg.23 turns off
#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