ejfield
Posts: 17
Joined: Fri Oct 19, 2012 10:21 am

WiringPython - from the beginning

Sun Mar 17, 2013 9:29 am

Hello all you helpful clever people!

There is a lengthy thread on WiringPython elsewhere, but I got a bit lost wading through it, some of the links are broken, other bits are a bit confusing (to me anyway), so I thought it best to start a new thread.

I (think) I want to try using Wiring Python, as an alternative to GPIO/RPIO, because I need some faster (output) GPIO. Also, I made a decision early on to stick with Python3, so I need to be able to use WiringPython with Python3, if that is possible. Stop me now if I'm barking up the wrong tree....

The first thing I need is a beginners (idiots if you prefer) guide to what I need to install, and how, to get me to the point where I can add "import wiringpi" to my Python3 program.

Then a pointer to a user guide would be useful.

Many thanks for any help..

User avatar
croston
Posts: 711
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: WiringPython - from the beginning

Sun Mar 17, 2013 9:50 am

Someone did some benchmark work a while back and found that RPi.GPIO is faster than WiringPython. If you are really bothered about speed then I suggest you use WiringPi for C, which is quite a lot faster.
Edit: found the benchmark article here - http://codeandlife.com/2012/07/03/bench ... pio-speed/

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: WiringPython - from the beginning

Sun Mar 17, 2013 2:47 pm

I use both, but one of the huge advantages of RPi.GPIO is exemplified by the previous post.

WiringPi-python has very little documentation and support as the guy who did the Python bindings Gadgetoid is focussed a lot on other languages and rarely comes to this section of the forums.

RPi.GPIO on the other hand is under constant development and was written by the author of the previous post. :D Post an issue here and likely as not it will be fixed in days (that's been proved already this week).

Both systems are good. If you want a third choice that is more heavily focussed on Python 3, you might want to consider the Quick2wire libraries as an alternative.

I like RPi.GPIO - even more now it can do interrupts with threaded callback.
Alex Eames RasPi.TV, RasP.iO

sportsnapper
Posts: 69
Joined: Wed Sep 05, 2012 11:27 am

Re: WiringPython - from the beginning

Sun Mar 17, 2013 5:28 pm

I think Alex is right.

I use the quick2wire libraries though, as they are python3, have the same pin numbering as WiringPi (which makes much more sense to me than any other) and you have interrupt support as well. Works well for me as I'm using their interface boards.

User avatar
croston
Posts: 711
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: WiringPython - from the beginning

Sun Mar 17, 2013 6:20 pm

RPi.GPIO runs under Python 3 and has interrupt support. It also has a choice of two pin numbering systems.

ejfield
Posts: 17
Joined: Fri Oct 19, 2012 10:21 am

Re: WiringPython - from the beginning

Mon Mar 18, 2013 3:41 pm

Thanks for the useful input, particularly the link to the benchmarks. For some reason I had got the idea that WiringPi was faster than GPIO/RPIO, neither of which is anything like fast enough for my application. I'd got rather hung-up on Python, probably because it's (relatively) easy to use and (comparatively) well documented, but I've belatedly realised that GPIO/WiringPi are not the problem, it's Python, which just isn't suitable for what I'm doing. The only sensible thing to do is rewrite my application code in C. Shame really, I was starting to quite like Python......

Incidentally, I'd still like to know how to get up and running with WiringPython, but the fact that no-one has attempted to answer my original question speaks volumes! Perhaps I'll stick with GPIO, at least in Python.

regards
Ed

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: WiringPython - from the beginning

Mon Mar 18, 2013 5:18 pm

ejfield wrote:
Incidentally, I'd still like to know how to get up and running with WiringPython, but the fact that no-one has attempted to answer my original question speaks volumes! Perhaps I'll stick with GPIO, at least in Python.
From the Python GB software readme

2) WiringPi for Python
If you don't have WiringPi for Python installed already, the best way to install it
is...

Code: Select all

sudo apt-get update
sudo apt-get install python-dev python-pip
sudo pip install wiringpi
Works for me and I've had no complaints with >2k downloads
Alex Eames RasPi.TV, RasP.iO

Return to “Python”