GPIO module for Raspberry Pi now on GitHub

The GPIO module that is used to communicate with the GPIO port on Raspberry Pi is now available on GitHub:

https://github.com/xojo/GPIO

A couple example projects that use it are included with Xojo:

Examples/Platform-Specific/Linux/RaspberryPi

Paul,
I have cloned the above repo and now have the GPIO module.

Your site says the following:

Where do I need to install the wiringPi? On my iMac or on the Pi itself?
The wiringPi site also says do not download the GitHub version, but there seems to only be GitHub versions to download??

Thanks.

On your Pi.
Try this command: sudo apt-get install wiringpi
It will install wiringpi or update it if there’s a newer version :slight_smile:
(I think it’s installed by default in Jessie)

You can also use this command: gpio -v
If it works, wiringpi is installed.

Thanks Albin - much appreciated.

The Download and Install page on the WiringPi site has step-by-step instructions.

Yes - I saw that page, but it says do not install the git version - but both versions seem to be git versions?
Never mind - I installed it as Albin recommended, and now everything is ok.

Thanks.

The wording on the site may be a bit confusing. It says not to install the “GitHub” version, which is a different thing than the “Git” version.

Ahhh, that makes a bit more sense :slight_smile:
Thank you Paul.

I’ve updated the Xojo GPIO library with new features to support tones, pwm (servo/RGB LED) and LCD character displays.

https://github.com/xojo/GPIO

I had tried the GPIO library and it works fine in a Console App running from the Terminal.
I also tried the same library in a Desktop App.
In this case the App works fine if I excecute it from the Terminal, but not if I excecute it directly with a double click on the EXE file.
Any idea why this happened ???

Accessing the GPIO requires sudo unless you are running Raspbian Jessie and set an environment variable. More information here: Raspberry Pi Desktop GPIO

Thanks Paul.
I do have Jessie running and I do run th commands:
export WIRINGPI_GPIOMEM=1
./MyApp
Doing this MyApp runs OK, but if I want to start MyApp from the File Manager and not from the Terminal with a sudo command the application didn’t run.
By your answer I understand that I need super user privilegies.
How may I set this privelegies in order to run MyApp from the File Manager without the need to type the sudo command

If you are on sharing screen then you need the gksudo command…
From the linux desktop open the terminal and write the

gksudo ./YourApplication

I don’t really know. Perhaps you can set that environment variable at “boot time” so that it is recognized by the File Manager? I don’t know enough about Raspbian to know if that is practical, though.

Edit: Or maybe you can create a File Manager shortcut that uses the gksudo ./YourApp as the command to launch?

Maybe you ought to add it to your bash profile.

I have to edit the /etc/profile file (e.g. sudo nano /etc/profile)

i insert the export line WIRINGPI_GPIOMEM=1
and i save

it seems to work !

below is the profile file

/etc/profile: system-wide .profile file for the Bourne shell (sh(1))

and Bourne compatible shells (bash(1), ksh(1), ash(1), …).

if [ “id -u” -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH
export WIRINGPI_GPIOMEM=1 # I ADD THIS LINE TO ALLOW USE OF GPIO AND THIS WORK

if [ “$PS1” ]; then
if [ “$BASH” ] && [ “$BASH” != “/bin/sh” ]; then
# The file bash.bashrc already sets the default PS1.
# PS1=’\h:\w\$ ’