Go to advanced search

by gadgetoid
Mon Jul 09, 2012 1:23 pm
Forum: Other programming languages
Topic: Perl
Replies: 47
Views: 19535

Re: Perl

For anyone interested, I have a project in the works to wrap up WiringPi for Perl, to join the Ruby and Python versions I'm maintaining. I'm not doing anything clever, the enterprising individual could probably just grab my Python version, compile SWIG 2.0 from source ( unless they're using Rapsbian...
by gadgetoid
Mon Jul 09, 2012 1:11 pm
Forum: Python
Topic: Nokia Pi LCD
Replies: 253
Views: 121454

Re: Nokia Pi LCD

I just bought one from Hobbytronics. I've given up waiting for the negative ST graphics LCD that I wanted from Adafruit. £7 isn't a bad pop for a bit of LCD driving fun. Will be interesting trying to get this to work in Ruby with WiringPiGem! I should probably learn Python, though, as it seems to ga...
by gadgetoid
Mon Jul 09, 2012 12:40 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

I,m thinking it was shifting out too fast for the LCD to handle, not the pi ;) I will give this a go later. Can you confirm that the clock signal goes high, then low with the shiftout function? T. The Pi could well be having trouble depending on the speed of operation. If you're crossing into MHz t...
by gadgetoid
Mon Jul 09, 2012 7:53 am
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

It could well be that it shifts out too fast for the Pi to handle; which might result in an output that the shift register dislikes. I think a shiftOutWithDelay method might help diagnose this. I've added one to the repo, grab it, reinstall and then: wiringpi.shiftOutWithDelay(data_pin, clock_pin, b...
by gadgetoid
Sun Jul 08, 2012 10:39 am
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

It looks right. Have you hooked up anything to the Data pin to see if it's toggling as expected? You can see the inner-workings of shiftOut here: https://github.com/Gadgetoid/WiringPi/blob/master/wiringPi/wiringShift.c It could very well be that shiftOut is borked in WiringPython due to discrepancie...
by gadgetoid
Sat Jul 07, 2012 3:10 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

Great news that it works! Aye, LSBFIRST = 0, MSBFIRST = 1. I'm hoping to include a .py wrapper which will have constants for these. Good luck with shiftOut, I'm eager to learn how all these things are done in Python specifically. I've already written a helper for Ruby which shifts out an arbitrary l...
by gadgetoid
Sat Jul 07, 2012 2:31 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

It could be something to do with the different pin numberings. Try pin 0 instead of pin 17. Gordon's pin mappings are here: https://projects.drogon.net/raspberry-pi/wiringpi/pins/ You might be able to use: wiringpi.wiringPiGpioMode(1) To switch it into a more familiar (GPIO) pin numbering mode. Sorr...
by gadgetoid
Fri Jul 06, 2012 12:25 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

But on the eLinux wiki, it's written that any python script willing to control GPIO has to be run as root, and this includes the RPi.CPIO module. This is not generally true, and WiringPython will ultimately not require root when the latest updates from Gordon are merged in. What RPi.GPIO is doing, ...
by gadgetoid
Fri Jul 06, 2012 12:19 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

Finally got some time to play with wiringpi, but failed at the first hurdle - I cannot install it ! It cannot find Python.h I have tried a 'find / -name Python.h' .....and it is nowhere to be found on my system :?: What am I doing wrong, or are the instructions somewhat incomplete (for a newbe) ? T...
by gadgetoid
Wed Jul 04, 2012 7:51 am
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

I pushed the zip into my Dropbox, see if you can get it from there: http://db.tt/3R4UQ7WO

Alternatively you could install git and grab the files with "git clone https://github.com/Gadgetoid/WiringPython.git"
by gadgetoid
Tue Jul 03, 2012 3:44 pm
Forum: Python
Topic: Python / GPIO speed
Replies: 14
Views: 9348

Re: Python / GPIO speed

Ahh that code!

You can find it here: http://pi.gadgetoid.co.uk/GPIO_OUT_class.py
by gadgetoid
Tue Jul 03, 2012 2:18 pm
Forum: Python
Topic: Python / GPIO speed
Replies: 14
Views: 9348

Re: Python / GPIO speed

texy wrote: Lookin' good! Any chance you could give access to the updated code please?
WiringPython is a Python-wrapped version of Gordon's WiringPi C/C++ library, which you can get from here: https://github.com/Gadgetoid/WiringPython
by gadgetoid
Tue Jul 03, 2012 1:26 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

Nice work. I found your other thread, hacked up that script, and posted a benchmark that includes WiringPython. If you don't mind running as root, there's no contest. If you ever get the chance to give WiringPython a try in your real-world use case, I'd love to know how it fares. For raw performance...
by gadgetoid
Tue Jul 03, 2012 1:22 pm
Forum: Python
Topic: Python / GPIO speed
Replies: 14
Views: 9348

Re: Python / GPIO speed

To test WiringPython, which accesses GPIO using shared-memory ( requires root ) I hacked WiringPython into GPIO_OUT_class.py and added an additional test: 10000 writes using standard output method: 6.21796417236 seconds (804.121712734 Hz) 10000 writes using GPIO_OUT class output method: 0.5892589092...
by gadgetoid
Tue Jul 03, 2012 12:37 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

Just FYI, I've been tinkering with RPi.GPIO for speed improvements - at least for output - and have managed about a 10x improvement on the standard setup by simply holding the files open for multiple writes, instead of opening/closing them for each write (you need to .flush() of course). That's a c...
by gadgetoid
Tue Jul 03, 2012 11:40 am
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

I'd often assumed /sys/class/gpio to be slow, which is why I haven't explored it in any depth. I get stupendous performance out of the shared-memory mode in C, but obviously using it in Ruby incurs a penalty. So, whilst shared memory may be faster, it may not necessarily make a difference if the bot...
by gadgetoid
Tue Jul 03, 2012 8:47 am
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

At the moment, no. It's based on Gordon's WiringPi which accesses the GPIO via shared memory or some trickery like that.

I believe a /sys/class/gpio version of the underlying library is coming, but I'm not sure when. When it does, it will be added into WiringPython and WiringPiGem.
by gadgetoid
Tue Jul 03, 2012 8:03 am
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

Re: WiringPython - WiringPi for Python

Wasn't aware of RPi.GPIO before. I don't know if it has shiftOut or serial functions? WiringPython does. I'll endeavour to produce examples, but since I'm no Python developer they may not be particularly good. Generally you would: import wiringpi wiringpi.wiringPiSetup IO: wiringpi.pinMode(1,1) // S...
by gadgetoid
Mon Jul 02, 2012 12:32 pm
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 74186

WiringPython - WiringPi for Python

First and foremost, a million and one thanks to Gordon for doing all the hard work and producing WiringPi in the first place. You can learn more about it here: https://projects.drogon.net/raspberry-pi/wiringpi/ Not knowing if anyone had done it before, I decided to wrap up WiringPi for Python. Unfor...
by gadgetoid
Sun Jun 03, 2012 10:07 pm
Forum: Other programming languages
Topic: PHP
Replies: 12
Views: 5868

Re: PHP

GordonDrogon's WiringPi should be wrappable for PHP. It has the same drawback: requires root privileges. But when I benched a properly wrapped library against shell-exec the difference in speed was immense. You won't notice this when switching a few LEDs, but if you try to interface with anything mo...
by gadgetoid
Mon May 21, 2012 5:48 pm
Forum: Other programming languages
Topic: Assembly Code
Replies: 60
Views: 22416

Re: Assembly Code

Moving swiftly away from the gentlemans flame-war over the virtues of assembly... does anyone know how one would go about manipulating the GPIO from assembly?

It would be an interesting exercise to write an LED control program entirely in assembly, if it's possible!
by gadgetoid
Sun May 20, 2012 8:31 pm
Forum: Other programming languages
Topic: Assembly Code
Replies: 60
Views: 22416

Re: Assembly Code

Oo, would be nice to drop the % and the $, both have been irritating to say the least. The latter because $n is in my vimrc as a shortcut for blocks of parenthesis... so occasionally it'll explode my code if I type too fast.

What would .code 32 do?
by gadgetoid
Sun May 20, 2012 6:39 pm
Forum: Other programming languages
Topic: Assembly Code
Replies: 60
Views: 22416

Re: Assembly Code

I've been using "as" which is presumably an assembler? I finally got it working, interestingly the solution I eventually came across was the same as that from funnel (thanks, your suggestion would have saved my poor brain if I hadn't found it by sheer determination alone) I humbly submit m...
by gadgetoid
Sun May 20, 2012 5:23 pm
Forum: Other programming languages
Topic: Assembly Code
Replies: 60
Views: 22416

Re: Assembly Code

I've been reading the Programming From The Ground Up book, too, and have had some trouble converting the Assembly syntax into something that works for ARM. I worked most of it out eventually, but got stuck on: movl data_items(,%edi,4), %eax This is used to access data_items, using register %edi with...
by gadgetoid
Thu May 17, 2012 2:32 pm
Forum: Gaming
Topic: Minecraft
Replies: 62
Views: 40249

Re: Minecraft

Alas, the forums need more edit button! A few hundred chunks later and I managed to connect... it spawned me in the middle of the ocean which was puzzling, but I swam to the shore and grabbed a screenie along with my SSH session with the running MC Server. Note the 1-3 seconds between chunk generati...

Go to advanced search