PiScanner – GPIO output | Documentation [Research]

I will need to illuminate the “subjects” that I will be capturing. In order to do this, I will eventually need to set some pin high. Weather it be that it sets of a camera flash or turns on some lights for a second, it will need to happen down the line.

 

Like all of my “research” I mostly googled around / plugged in code until something worked. I came back with these links:

http://www.youtube.com/watch?v=q_NvDTZIaS4

https://docs.google.com/file/d/0B2-00drKdqF0V09YSHgxcTEtelk/edit

http://hackaday.com/2012/06/17/using-the-gpio-pins-on-a-raspberry-pi/

 

Basically you need to install the Raspberry Pi GPIO, Import and use the RPi GPIO

1. Download the library:

$ wget http://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.2.0.tar.gz#md5=0fc4bfa6aabc856b0b75252a40ac75cc

2. unzip the file:

$ sudo tar -zxvf RPi.GPIO-0.2.0.tar.gz

you can remove the .tar.gz at that point

3. get into the directory you just created:

$ cd  RPi.GPIO-0.2.0

4. The devs included a great install script with this package, run it to install with:

$ sudo python setup.py install

Now you should see a bunch of text in the command line. I have no idea why, but my first run of this command didn’t “take” but I ran it again and now it works great.

 

To use this, you need to know what pins correspond to pins on the RPi. You can google this yourself.

 

Now we get writing code. I’m using a graphical python editor called geaney which comes pre-loaded with squeeze.

 

To blink pins 11 and 13, use and run this python script.

You can see the plaintext version of that script here.

 

Essentially i’m trying to mimic things I’ve done with an Arduino for some time.

Maybe later today (if I can somehow find a 100ohm resistor) I’ll work on using inputs. I have a PIR motion sensor with me, but I neglected to bring the proper resistor to use it. I do have tack switches and resistors for those, which I could use to mimic the motion detector, but I don’t think that would be as cool.

 

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Leave a Reply

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