Raspberry Pi GPIO and Python

Raspberry Pi GPIO and Python

I had to get the gpio software from,  it is available for both python 2 and 3

http://code.google.com/p/raspberry-gpio-python/

Hint you can use wget -c http://raspberry-gpio-python.googlecode.com/files/python-rpi.gpio_0.4.1a-1_armhf.deb or replace the above with the other filename for python 3.
you then install withsudo dpkg -i python-rpi.gpio_0.4.1a-1_armhf.deb

You can then control the ladder board from python,

The following simple program lights up 2 LEDS on Gordon Hendersons ladder board.

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(11, GPIO.IN)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(12, GPIO.IN)
while 1:
if GPIO.input(11):
GPIO.output(13, False)
else:
GPIO.output(13, True)

if GPIO.input(12):
GPIO.output(15, False)
else:
GPIO.output(15, True)

Gordon has also written return to basic,  which is for the PI,  this also controls the same ladder board,  more information is his site above.

 

 

The Following site may be useful as it has a free download and print guide to the GPIO pins.

 

http://www.raspberrypi.org/archives/3307