Securing The Future Bit By Bit

Monday, July 22, 2019

Blink Led using Raspberry pi 3 with Python script.

In this blog, I will explain how to blink a led using raspberry pi 3 with python code.


Components Required
1. Raspberry pi 3
2. Led
3. jumper wires
4. Breadboard
5. 220 ohm Resistor

Circuit Diagram

Step1- Make connection as shown in above figure.
Step2- Connect led +ve pin to 7 pin of raspberry pi and -ve pin of led to 39 pin of raspberry pi.
Step3- Resistor must be connected otherwise led will fused.
Step4- Download the code and upload the raspberry pi.
via element14.com

Program Code

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)

i = 1
while(i<=5):
    GPIO.output(7,True)
    time.sleep(1)
    GPIO.output(7,False)
    time.sleep(1)
    i = i + 1
GPIO.cleanup()


Download code file from here

Media Gallary



Share:

0 comments:

Post a Comment

ElectrocoreDIY.com

Search This Blog

Blog Archive

Powered by Blogger.

Privacy Policy