This script blinks multiple LEDs in sequence. Driver pins on the GPIO are 11, 13, 15 and 19 with pin 9 acting as the ground. There’s a 470 ohm resister between driver pins and the lamp.
The speed can be adjusted by modifying the “time.sleep(.1)” directive in the blink function. Changing it to ‘1’ will result in a one second on, one second off blinking lamp. ‘.1’ is much quicker and more entertaining to watch.
import RPi.GPIO as GPIO GPIO.cleanup() import time # blinking function def blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(.1) GPIO.output(pin,GPIO.LOW) time.sleep(.1) return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GPIO.setup(11, GPIO.OUT) GPIO.setup(13, GPIO.OUT) GPIO.setup(15, GPIO.OUT) GPIO.setup(19, GPIO.OUT) # blink GPIO17 50 times for i in range(0,5): blink(11) blink(13) blink(15) blink(19) GPIO.cleanup()