We’re currently testing our Python library for controlling GPIO on the Raspberry Pi. Once it’s ready for prime time we’ll be releasing it on github, like the gpio-admin library on which it relies, under an Open Source License.

We’ve put up a basic demo on YouTube; the first one isn’t that exciting, as one flashing LED looks much like another. We hope to have some prettier videos soon.

Here’s the code that drives the LED:

from quick2wire.gpio import Pin
from time import sleep

out_pin = Pin(12, Pin.Out)
for i in range(0, 10):
    out_pin.value = 1
    sleep(1)
    out_pin.value = 0
    sleep(1)
out_pin.unexport()

The ’12′ used to identify the pin refers to the pin number on the expansion header. You can find a neat diagram of the header here.

About the author: Romilly Cocking

3 Comments

  1. Nice one, Guys. My Pi is due for delivery next week & your blinking LED code is the first thing I’m gonna try out!
    I’ll check this out on You Tube as well.

    Reply

  2. Awesome, thank you, I’ll be using this as a way to display the status of programs running on the RPi in situations where there wont be a screen ;)

    Reply

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>