Start Your First Project With Raspberry : Blinking LED

Introduction: Start Your First Project With Raspberry : Blinking LED

About: For more project and tutorial visit my YouTube Channel Smart Technology

In this project I am going to show you how to program Raspberry Pi to make an LED blink,If you have nearly bought a Raspberry pi and you don't know anything where to start,this tutorial it fits in.

In addition to your Raspberry Pi running Raspbian, you will need :

1. 330 Ohms resistor

2. LED

3. Breadboard

4. Some wires

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Install Operating System in Pi

You can skip this step if you have installed the OS already in the Pi.If yes then go to step 2 or else look the complete OS installing instructions in this link that I uploaded.

https://www.instructables.com/id/Build-Your-Own-PC-With-Raspberry/

Step 2: Schematic of the Circuit

Kindly follow the steps bellow :

1. Connect a 220Ω resistor to the anode of the LED,then the resistor to 5 V.

2. Connect the cathode of the LED to GPIO (See the picture above).

Step 3: Watch the Video for More Details

Step 4: Python Code

You are now ready to write some code to switch the LED on.

NOTE : All following steps are explained in the video.


1. Turn on your Pi and Create a new text file “BLINK.py” .

=====================================================================================

2. Type in the following code:

import RPi.GPIO as GPIO
import time

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BCM)

GPIO.setup(17,GPIO.OUT) #Define pin 17 as an output pin

while True:

GPIO.output(17,True) #Outputs digital HIGH signal (5V) on pin 3

time.sleep(2) #Time delay of 2 second

print( ' Hello ' ) #Print when the LED turn ON

GPIO.output(17,False) #Outputs digital LOW signal (0V) on pin 3

time.sleep(2) #Time delay of 2 second

=====================================================================================

3. Once you have typed all the code checked save it.

=====================================================================================

4. Run the python code by typing the following code in the terminal:

- cd Desktop and press Enter( I type Desktop because I have saved the file in the pi's Desktop).

- python BLINK.py and pressEnter.

=====================================================================================

You will see the LED turn on for two seconds and then turn off for two seconds too.

I hope you enjoy with this project.

LED Contest 2017

Participated in the
LED Contest 2017

Raspberry Pi Contest 2017

Participated in the
Raspberry Pi Contest 2017

Be the First to Share

    Recommendations

    • Arduino Contest 2020

      Arduino Contest 2020
    • First Time Author Contest

      First Time Author Contest
    • Space Challenge

      Space Challenge

    Discussions