Posts: 8
Joined: Tue Jun 28, 2016 9:59 am

Choosing a language

Tue Jun 28, 2016 2:23 pm


I am currently planning to write a program which not only uses SPI and the GPIO but needs to have a graphical user interface. As far as I'm aware, the best tools for using SPI and GPIO are the wiringPi libraries. However, the graphical tools for C++, again as far as I'm aware, are not as good as those for python, and I am struggling to find well supported and documented python SPI libraries.

Furthermore, I am planning to use the camera module, and hence a good API for the camera would also be incredibly beneficial.

An option is having a C++ script running in the background and maybe saving info to a file which is being read by a python GUI which will act as I/O. However, this would raise issues with regards to writing and reading to a file at the same time.

I was wondering whether anybody could offer me any suggestions, especially regarding which APIs to used and anything I could use to synchronise timings between two different scripts.


Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 82
Joined: Sat Aug 08, 2015 11:30 am

Re: Choosing a language

Wed Jun 29, 2016 7:04 am

As often with these types of questions, you'll get opinions rather than answers.

For my two-pence worth, I'd recommend Python3. Excellent GPIO (have you tried gpiozero support and the PiCamera library is excellent and well documented

With regards to SPI, spidev seems popular, although I would have to agree the documentation isn't great

User avatar
Posts: 235
Joined: Sun Aug 19, 2012 11:19 am
Location: Cambridgeshire, UK
Contact: Website Twitter

Re: Choosing a language

Fri Jul 01, 2016 7:49 pm

GPIO Zero supports the SPI protocol and a few SPI devices too.

As for user interfaces, you could use PyGame Zero or just PyGame. There are others in Python, such as tkinker and qt...

If you want to use C++, there's a great C library called pigpio which is installed by default in Raspbian too. Documentation here:
Former RPF staff. Author of gpiozero and creator of piwheels.

User avatar
Posts: 40123
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Choosing a language

Fri Jul 01, 2016 8:07 pm

ben_nuttall wrote:GPIO Zero supports the SPI protocol and a few SPI devices too.
Does it support two MCP3008s on a single RPi? If so do I daisy chain them on one SPI chip select or have one on /dev/spidev0.0 and the other on /dev/spidev0.1?
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Posts: 1354
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Choosing a language

Fri Jul 01, 2016 10:26 pm

I'd use Squeak Smalltalk. Talk to wiringPi or pigpio easily - pigpio is included in the Raspbian distort now to support Scratch, which is written in Squeak. I've got support for i2c & api & 1wire devices as well as general gpio driving. Oh, and the camera module. Obviously, Squeak has good GUI support since Smalltalk is the system in which the entire concept was pretty much invented. Pretty good sound support too. Runs very nicely on a Pi2/3, decently on a 0.

The Squeak vm is (obviously) included in Raspbian and so you only need to download the image/changes/sources trio of files to get going.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

Return to “Beginners”