Created
June 17, 2015 12:04
-
-
Save uktechreviews/40c650e80325f26f9a7d to your computer and use it in GitHub Desktop.
Traffic Light Project
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 libraries | |
import time | |
import RPi.GPIO as GPIO | |
# Setup GPIO pins | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(3,GPIO.OUT) | |
GPIO.setup(5,GPIO.OUT) | |
GPIO.setup(7,GPIO.OUT) | |
#Switch off all the LEDs | |
GPIO.output(3,GPIO.LOW) | |
GPIO.output(5,GPIO.LOW) | |
GPIO.output(7,GPIO.LOW) | |
#Switch on the LEDs | |
GPIO.output(3,GPIO.HIGH) | |
time.sleep(1) | |
GPIO.output(5,GPIO.HIGH) | |
time.sleep(1) | |
GPIO.output(7,GPIO.HIGH) | |
#End the code cleanly | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment