Blink the light - we did that above. Now let's
understand the program.
#!
/usr/bin/python
# Flash a LED
# Import the libraries we need
import RPi.GPIO as GPIO
import time
# Set the pin mode to Broadcom mode this time.
GPIO.setmode (GPIO.BCM)
pin = 17
# Set the pin to be an output
GPIO.setup (pin, GPIO.OUT)
i=0
# Loop turning it on and off
while i < 10:
GPIO.output (pin, 1)
time.sleep (1)
GPIO.output (pin, 0)
time.sleep (1)
i = i + 1
# Set the pins back to default
GPIO.cleanup ()