• RSSRSS
  • TwitterTwitter
  • FacebookFacebook
  • About
  • Privacy Policy
  • Contact Us

Raspberry Pi Blog

Get Guides,Tips,Tricks And Information Related To Raspberry Pi

Powered by Blogger.
  • Home
  • GPIO
  • I2C
  • SSH
  • LCD
  • Hardware
    • I2C
    • ADC
    • PWM
    • LED
    • LCD
  • Software
    • Python
    • C
    • Programming
    • SSH

led status infi
There are 5 status LED's on the Raspberry Pi board namely [OK, PWR, FDX, LNK, 10M]. FDX, LNK, 10M are connected to the LAN IC- LAN9512. So those 3 LED's will be present only on model B.

According to http://elinux.org/RPi_Hardware

D5(Green) - OK - SDCard Access (via GPIO16)
D6(Red) - PWR - 3.3 V Power
D7(Green) - FDX - Full Duplex (LAN) (Model B)
                                                      D8(Green) - LNK - Link/Activity (LAN) (Model B)
                                                      D9(Yellow) - 10M - 10/100Mbit (LAN) (Model B)

According to the datasheet the pins can also be programmed as GPIO, so these three LEDs could potentially be under software control, but I have not checked if the Linux drivers support this.

One of the few things that separates the Pi from other SBC (Single Board Computer)  is the ability to use the GPIO (General Purpose Input/Output) pins which can be set as HIGH or LOW to control any external devices. All you need is a female to male jumper wire to get started. Here I have used a HDD IDE connector to get the job done.

In this post pin 9 is used for GND and pin 11 for GPIO17. The LED was connected using a 470 ohm register in series with pin 9 and 11 to limit the current.

GPIO of raspberry pi
Software Implementation:-

The fastest way to get started is to use python which comes pre-installed with all images. Download the RPi.GPIO library and copy the gz tar ball to the RPi wheezy raspbian. Open the terminal and navigate to the extracted folder containing the RPi.GPIO library. Then type:  $ sudo python setup.py install to install the module. Imp: As the OS is multitasking  and not Real-time unlike Arduino there may be jitters depending on CPU priority.

Based on the library I have written a simple code to turn ON and turn OFF the LED after a delay of 1 sec (1000ms) each.The LED blinks 50 times.
import RPi.GPIO as GPIO
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)
# blink GPIO17 50 times
for i in range(0,50):
        blink(11)
GPIO.cleanup() 

led blinking with raspberry pi           

Recent Posts


Recent Comments

Copyright 2013 RPiBlog. All Rights Reserved.

Site Developed By Rahul Kar