Introduction: Flashing LEDs With Raspberry Pi

Flashing LEDs simple Project for kids.

What you Need:

  1. Two different colours LED
  2. 1k ohm resistor
  3. Breadboard
  4. Male to female Jumper cables
  5. Raspberry pi

Step 1: Python Program

import RPi.GPIO as GPIO

import time

# blinking function def blink(pin):

GPIO.output(pin,GPIO.HIGH)

time.sleep(0.25)

GPIO.output(pin,GPIO.LOW)

time.sleep(0.25)

return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD)

# set up GPIO output channel GPIO.setup(11, GPIO.OUT)

GPIO.setup(07, GPIO.OUT)

# blink GPIO4 10 times

# blink GPIO17 10 times for i in range(0,1000):

blink(07) blink(11)

GPIO.cleanup()

Comments

author
DanielL175 (author)2016-02-24

I did something similar with an RGB LED. I would be more interested in a script to work under a web site. Any ideas?

author
jlepack (author)2016-02-20

I'm just starting to learn python and I actually understand what your code is doing! raspberry pi's are cool!

author
DIY Hacks and How Tos (author)2016-02-20

Great intro project. This was one of my first Raspberry Pi projects.