How To Connect LED On Raspberry pi
You want to know how to connect LED on Raspberry Pi. Today I Show you How How To Connect LED On Raspberry pi in easy ProcessRequired Component connect LED Raspberry Pi :
1.Raspberry pi 5. 5mm LED
This book will help you to gain more knowledge of Raspberry pi Software and Hardware Problems and Solutions
Raspberry Pi Cookbook
Circuit diagram connects LED Raspberry Pi:
shows how you can wire this LED using a solderless breadboard and male-to-female jumper leadsConnecting an LED to a Raspberry Pi
Having connected the LED, we need to be able to turn it on and off using commands from Python. Start a Python console from the Terminal with superuser access and enter these commands:
$ sudo pythonimport RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.OUT) GPIO.output(12, True) GPIO.output(12, False)LEDs are a very useful, cheap, and efficient way of producing light, but you do have to be careful about how you use them. If they are connected directly to a voltage source (such as a GPIO output) that is greater than about 1.7 volts, they will draw a very large current. This can often be enough to destroy the LED or whatever is providing the current—which is not good if your Raspberry Pi is providing the current. You should always use a series resistor with an LED because the series the resistor is placed between the LED and the voltage source, which limits the amount of current flowing through the LED to a level that is safe for both the LED and the GPIO pin driving it If you want to extend the experiments that you made in the Python console into a program that makes the LED blink on and off repeatedly, you could paste the following code into the IDLE
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.OUT) while (True): GPIO.output(12, True) time.sleep(0.5) GPIO.output(12, False) time.sleep(0.5)
No comments