Friday, May 10, 2013

5: I have added some gear:
1. a full-sized breadboard
2. some F/M jumper wires
3. some LEDs (with matching resisters) and button switches

I added the GPIO software to my Pi (via the dangerous "sudo apt-get install ..." method, but this time backing everything up).

My first attempt was the obvious "make an LED blink" program. My first four attempts didn't work. Guess why-- nobody told me that LEDs care which wire is positive. Four tries and I never guessed right! Finally got the hint from a Youtube lesson. The longer wire on the LED has to be the positive side. Duh.

I got some button switches too. They work (sort of) with my Python code but not reliably. I've tried testing button depressed, button edge down, button edge up. Also, different sleeps between tests. Not reliable yet.

Here's a confusion: GPIO pin numbering. There are at least 3 schemes. Two are shown below.

If your Python shows:
import RPi.GPIO as GPIO
. . .

You will use actual pin numbers (they aren't numbered on the 26-pin connector, you have to count). Those numbers are in the 2 center columns, above. But if you replace the 2nd line of code above with:

Then you are using the"GPIO" numbers shown in the outer 2 columns. I'm not getting into the third scheme, yet.

In the meanwhile, I've ordered more jumpers (can't get by with M/F) a wide assortment of resisters, plus temperature and motion sensors.

No comments:

Post a Comment