Skip to content

Instantly share code, notes, and snippets.

@uktechreviews
Created June 17, 2015 12:04
Show Gist options
  • Save uktechreviews/40c650e80325f26f9a7d to your computer and use it in GitHub Desktop.
Save uktechreviews/40c650e80325f26f9a7d to your computer and use it in GitHub Desktop.
Traffic Light Project
# 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