RPI 3 GPIO via WiringPI - not reading / getting desperate

Hello Kind souls,

Project deadline is tomorrow and at the last minute we’ve had to change from Processing to OF (wish that happened sooner!). I’m not totally new to OF, but things like this make me doubt I have any grip…

Setup is a RPI 3 running OF 0.9.3 on Raspbian GNU/Linux 8 Jessie

The pi has WiringPI installed and DOES read correctly from the GPIO in Processing.

With the exact same button wiring I’m attempting to get OF to read a pin.
I had successfully done this at some point on a RPI 2, and still had the code.
This is the reference I originally used:

My code is basically identical. (Not sure how to post code… says new users can’t upload files.)

I’ve added this to the config.make:

PROJECT_LDFLAGS=-Wl,-rpath=./libs
PROJECT_LDFLAGS += -lwiringPi

And when I run the compiled project I use: sudo make run
as @jvcleave suggests somewhere (I do get a system complaint if running without ‘sudo’).

Like I said, it compiles and runs. Just not getting any action - where the same thing in processing yields expected results (Pin 6 goes from HIGH to LOW).

Any help is greatly appreciate - if you’re near by, beer on me!
thanks

it’s been a while since I have messed with it but I don’t think you need to compile wiringPi yourself anymore. It is available via

sudo apt-get install wiringPi

You also will probably have to do

sudo raspi-config

and under Advanced options enable SPI and maybe I2C

Once you do that I would see if you can get wiringPi examples to work. If that works, the next step would be to then get it into OF

jvcleave,
Thank you very much for responding!!
Figured it out!

I did have wiringPi installed…
when i ran dpkg -l it was listed there.

i had not made the raspi-config changes you suggested, but think they were enabled already.

I tried some of the wiringpi examples (nice to look at C code!) to no avail…
Then I remembered there was a utility which, i think, installs with wiringPI

GPIO readall will give you a list of the current state of every GPIO.
it also conveniently lists the wiringPi pin number v.s the BCM pin number.

I then wired up some buttons and ran that a couple times until I could see that everything was actually working… in my OF code i was just reading the WRONG PINS. :blush:

Really, thank you so much. Sometimes it just helps to spell out the problem to imagined smart humans in the void… You getting back to me, magically cut my panic level in half and brought me back from pulling my hair out to thinking rationally. Grab that beer soon.

Cheers!!

1 Like