Sunday, June 23, 2019

Dual Color LED on Rasberry Pi - Lou Person - STEM - Girls Who Code

Go to page 28 of the manual http://gwc.daisyware.com/manual.pdf which will discuss what the Dual-Color LED does.
When you are done, the project will look like this:


First, since this is the first project, you will need to connect the ribbon cable to the Rasberry Pi and the T-Cobbler.  Reference the manual page 10.  See 38 Breadboard, 39 T-Cobber and 40 40-pin Ribbon Cable for T-Cobbler.  Be very careful you don't bend the pins in the T-Cobbler.  Also, be very careful of the Ribbon Cable, the ribbon is a bunch of 40 cables attached together, if you bend the ribbon, you could break one of the small cables.


Second, connect the Cobbler to the Rasberry Pi using the Ribbon, as shown below.  Make sure the first row of pins on the Cobbler lines up to the first row on the top of the Breadboard.  Don't bend the pins!



Fourth, now wire the project.  Page 29 will show how the wiring should be done. Note that the diagram shows a purple, green and black wire.  Our kit includes a 3 pin anti-reverse cable which is yellow, red and black.  So, the picture on page 29, the purple wire illustrated is the yellow wire in reality, the green wire illustrated is the red wire in reality and the black wire illustrated (grd) is the black wire in reality.  Page 29 will show how it should be wired (see below).  Note that there is an R, G and GND on the sensor.  The yellow wire will connect to GPIO17.  Take the pin of the yellow wire and insert it into the left hole in the GPI017 row.  The red wire will connect to GPIO18.  Thake the pin of the red wire and insert it into the right hole in the GPIO18 row.  The black wire will connect into the third group along the right edge, top right most hole as shown below.  Finally, connect the 4 wires as shown exactly below in the picture, also described here:
1) The top most, right most hole should have a black wire which connects to the right (second) hole in the gnd row.
2) The top most, second from right most hole, should have a red wire which connects to the right (second) hole on the 5V0 row.
3) The top most, left most hole should have a red wire which connects to the left (second) hole in the 3V3 row.
4) The top most, second from left most hole, should have a black wire which connects to the left (second) hole in the GND row.




Here is what is should look like when done (page 31) (note the gnd wire is not shown per instructions below and a white wire was used instead of a red).


Fifth, run the code and flash your light!
On the bottom of page 29 of the manual, under "For Python Users", enter the two commands.
First, enter this command and hit enter:
cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/
Second, enter this command and hit enter making your LED flash
sudo python 01_dule_color_led.py

By Lou Person


No comments:

Post a Comment