Flashing LEDs With Raspberry Pi

1,043

10

3

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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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()

Raspberry Pi Contest 2016

Participated in the
Raspberry Pi Contest 2016

Be the First to Share

    Recommendations

    • LED Strip Speed Challenge

      LED Strip Speed Challenge
    • Sculpting Challenge

      Sculpting Challenge
    • Clocks Contest

      Clocks Contest

    3 Discussions

    0
    DanielL175
    DanielL175

    4 years ago

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

    0
    jlepack
    jlepack

    4 years ago

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

    0
    DIY Hacks and How Tos

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