GUI Controlling GPIO

After looking at my RSS feed, I found this video by Matt Richardson that outlines how to make a LED on a breadboard controlled by a GUI. This is pretty cool. Watch the video to find out more, and you can find all of the code contained in a GitHub Gist. When you execute the code, you will find that you receive an error message. This can be fixed quite simply by downloading my alternate version of the Gist, or follow the instructions below:


Using My Pre-Edited Edition

1. Clone the repo by typing: git clone
2. Open the directory by typing: cd 5440177
3. Execute the script by typing: sudo python

Using The Original

1. Clone the repo by typing: git clone
2. Open the repo by typing: cd 5434591
3. Edit the Gist by typing: sudo nano
4. Make sure the “if” and the “else” statements are in line with each other by indenting the “if” statement.
5. Save and exit the script by pressing CTRL+X, Y, ENTER.
6. Execute the script by typing sudo python


2 thoughts on “GUI Controlling GPIO

  1. I am getting a weird error it says:

    Exception in Tkinter callback
    Traceback (most recent call last):
    File “/usr/lib/python2.7/lib-tk/”, line 1437, in __call__
    return self.func(*args)
    File””, line 11, in toggle
    if GPIO.input(24):
    WrongDirectionException: The GPIO channel has not been set up or is set up in the wrong direction

    Do you think this is an error due to tkinter being wrong or out of date or am I way off?

    • I hate to sound like those old brittish tv shows, but did rebooting it help? It looks like you have another python GPIO process running that’s conflicting with the program running. Let me know if it helps!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s