LED Blinking

803 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

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Related Post

Phase One

Posted by - August 15, 2015 2
“Phase One” is where we learned basic raspberry pi use. we started with the unboxing of our model 2 B raspberry…

GPS AT Commands

Posted by - October 18, 2015 0
AT+CGPSPWR? if off : AT+CGPSPWR=1 Get status : AT+CGPSSTATUS? Get GPS : AT+CGPSINF RESET CODES : What mode ? –…

google map link

Posted by - October 18, 2015 0
http://www.google.com/maps/place/40.625027,-73.957774/@40.625027,-73.957774,17z Change RED part to current GPS in Python   http://maps.google.com/maps?q=40.37494164,-73.57485968   Keep Reading : GPS AT Commands GPS RESPONSE…

Leave a comment

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