rzusman
Posts: 347
Joined: Fri Jan 01, 2016 10:27 pm

Multiple programs using pigpio

Thu Mar 31, 2016 2:17 am

What is the proper way to handle pigpio's initialization if there are multiple programs that need to run simultaneously?

Specifically, I have a background task which never quits, and must call gpioInitialise to monitor an IO pin. If I try to launch another program gpioInitialise fails with error -1 (presumably because it's already initialized). How should I handle this?

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Multiple programs using pigpio

Thu Mar 31, 2016 4:03 am

The other programs will have to use the socket or pipe interface to access the running library.

Only one program directly linked with the pigpio library can be run at a time (that program becomes the pigpio daemon).

That's how the Python module works. With C use http://abyz.co.uk/rpi/pigpio/pdif2.html

Return to “Advanced users”