One of the things that separates the Pi from other SBC (Single Board Computer) is the ability to use the GPIO (General Purpose Input/Output) pins 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.
Pin 9 is used for GND and pin 11 for GPIO17. The LED was connected using a 470 ohm register between pin 9 and 11 to limit the current.
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. 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.
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. 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()
