-
-
Save daniel-obrien/090fc384da115e34218f6024dd8fc8d3 to your computer and use it in GitHub Desktop.
STJLOL GPIO essential code
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
#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