LED Blinking

3236 0

You will need the following things:

  1. Raspberry pi configured (see previos lessons)
  2. 5 Volt LED bulb(s)
  3. 2 jumper wires m/f
  4. 1 wire cutter with wire striper. (often found on long pliers)

 

First you will need to  open terminal.What you need to type in terminal is :

 

Then you need to install the python development code:

 

Then you type:

 

Now we are done preparing your raspberry pi now lets prepare your cables and LED’s.

IMG_5049

 😎 First you should cut the Cable

On the same side of the wire strip off about one quarter inch with your wire cutter. You do this by placing the wire into the knot on the bottom. apply a little bit of pressure and pull down and back. After that you should have a striped wire. Do this twice.

With your striped wire you will want to find the LED and attach each of the striped sides of the wire to the LED leads.

IMG_5045

Please notice that on of the pins on your LEDs are not the same length. The long LED pin is the positive side and the short LED pin is the negative side. Remember which color wire you attached to the positive side and which on you connected to the negative.

IMG_3001

We need to connect the negative pin to any ground pin on your GPIO like in the pictures below. To find the pins on your raspberry pi i also included a pin chart to the raspberry pi 2 middle B, you might need to use Google if you have an older model of the raspberry pi.

Notice i used pin number 9 for my ground pin.

 

To do this you must connect the other wire to a positive pin out i used pin GPIO 11 after this it is time to write the program!!!!!!!!!!!!!!!!!!!!!!! 😎 😎

 

Go into the raspberry pi Menu, and under accessories, choose text editor. In your new file type your shebang line, same as before #!/usr/bin/python at the top. Skip a line and add the following code:

 

This sets the words GPIO and time to the commands wee will use for blinking ouor light and pausing. Next you will need the following commands.

This tells python to let us use the  GPIO pin board we then tell it to use the GPIO pin No. 11, to set it up for output, and to send 5v out through the pin. This makes your LED light up.

Now let’s finish our code:

This is the last of your code, you should now save your file. You should save it to Desktop at least thats what i did. I made my file “test_blink.py”, but you can name yours what ever you want.

Above, “time.sleep(.2)” tells our code to pause for 2.1 seconds, then “GPIO.output(11,GPIO.LOW)” turns the LED off again. “GPIO.cleanup()” tells the pi to clean every thing up, and let other programs use GPIO.

Now it time to make our code executable and run it, just like last lesson. Type the following command into your terminal:

Now your LED will blink.

 

IMG_2996

Facebooktwitterredditpinterestlinkedinmail

Related Post

Pi Camera Resolution Fix

Posted by - October 24, 2015 0
[crayon-6766acde5fef2743082615/] Keep Reading : Wire camera to pi while loop Hello World Remote ssh connect from iPad P.C. and laptop…

Mesopotamia

Posted by - February 28, 2017 0
For Mesopotamia : This page is a great resource, THE WESTERN TRADITION – Episodes #3 Mesopotamia and #4 From Bronze…

Raspi-config

Posted by - August 15, 2015 0
First you will need to open terminal. Terminal is located at the top of your raspberry pi screen. Terminal is…

Add Clock Via i2c

Posted by - October 24, 2015 0
Prepare i2c added real time clock driver to raspian Add time variable to picture display Solder pins to clock module…

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.