mrdebug wrote:One more question:
If I have more than one programs that implement PIGIO how have I to inizialize? For example when I run the firs program I can call
gpioInitialise
without problems. But when I run it from the second program I obtain an error.
Witch is the right way?
There may only be one copy of the library running at any one time (for a variety of reasons, but at its simplest hardware clocks are being altered and only one program should be in control at any one time).
A natural solution is to launch the library as a daemon (sudo pigpiod) and use the socket or pipe interface to get the information you need. Many programs may talk to the daemon at the same time.
That is how the Python module works. It is also how pigs works. From C there is a library specially for communication with the daemon, i.e.
libpigpiod_if. x_pigpiod_if.c is an example of its use.
Whatever method you use you will still receive the timestamped gpio events.