Requirements:
i)LED
ii)Resistor (470Ω)
fig.Resistor
iii)Beagle Bone Black
LED is Light Emitting Diode which can emit light when external power supply is apply to it.
Circuit Diagram of LED interfacing:
fig.Circuit Diagram of LED interfacing
Steps:
i) connect long terminal (Anode) of led to resistor .
ii) second terminal of resistor is connected to the GPIO pin of BBB.
iii) short terminal(Cathode) of led is connected to the ground.
Hardware setup of LED Interfacing with BBB :
Python code to blink single LED :
import Adafruit_BBIO.GPIO as GPIO # import library
import time # import time for time delay in second
GPIO.setup("P9_13", GPIO.OUT) # Set output pin of BBB
while(True): # infinite loop is given
GPIO.output("P9_13", GPIO.HIGH) # output pin is high
time.sleep(5) # time delay is given
GPIO.output("P9_13", GPIO.LOW) # output pin is Low
time.sleep(5) # Time delay is given
import Adafruit_BBIO.GPIO as GPIO # import library import time # import time for time delay in second GPIO.setup("P9_13", GPIO.OUT) # Set output pin of BBB while(True): # infinite loop is given GPIO.output("P9_13", GPIO.HIGH) # output pin is high time.sleep(5) # time delay is given GPIO.output("P9_13", GPIO.LOW) # output pin is Low time.sleep(5) # Time delay is given
No comments:
Post a Comment