- A light-emitting diode (LED) is a two-lead semiconductor light source.
- It is a p–n junction diode which emits light when activated.
- When a suitable voltage is applied to the leads, it blinks.
Figure 3 - BreadBoard
- An electronic breadboard (as opposed to the type on which sandwiches are made) is actually referring to a solder-less breadboard.
- These are great units for making temporary circuits and prototyping, and they require absolutely no soldering.
Figure 4 - Resistor
- A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element.
- In electronic circuits, resistors are used to reduce the current flow.
- Adjust signal levels, to divide voltages, bias active elements, and terminate transmission lines, among other uses.
Connection For Raspberry Pi
- Connect LED to Raspberry Pi in the Anode side to the input pin.
- Connect the Negative on the LED that is the cathode of the Gnd pin.
- And connect the Resistor of the Positive side to the LED.
Programming
- import GPIO.RPi as GPIO
- import time
- GPIO.setmode(GPIO.BOARD)
- GPIO.setup(11,GPIO.OUT)
- while 1:
- GPIO.output(11,1)
- time.sleep(1)
- GPIO.output(11,0)
- time.sleep(1)
First, we have to know the GPIO (General Purpose Input/Output). It can be controlled by the Run time user. At the start, we have to declare the Header file as in the below name, and add the Library to the board as the GPIO.
- import GPIO.RPi as GPIO
- import time
Next, set the input pin and output pin as the GPIO.setmode. It is used to give the Output of the source. Then, fix the time for blinking the LED and finally, it will process according to the Timesleep of the second. Finally, it will activate at the given time sleep.
- GPIO.output(11,1)
- time.sleep(1)
- GPIO.output(11,0)