I want to get time and count of input pulse in microseconds using pigpio. How can i Listen to gpio pin in spreate thread.

  • Do you want to use pigpio? If so what language do you want to use? pigpio provides a C and Python API for the socket interface. 3rd parties provide Erlang, Java, Node.js, and Xojo interfaces. – joan Mar 2 '18 at 12:01
  • Yes pigpio, c or java.. – pooya Mar 2 '18 at 12:15

By default pigpio samples GPIO 0-31 at a rate of 200 thousand times per second (once every 5µs).

You can register to be alerted when

  1. one or more of GPIO 0-31 change level
  2. one or more of GPIO 0-31 have not changed level for a timeout period

The pigpio daemon provides a socket interface to this information. Each report contains an incrementing sequence number, flags to indicate a timeout, the event tick, and a bit mask giving the levels of GPIO 0-31 at that event tick.

The event tick is a 32 bit microsecond counter which starts at boot and wraps around every 1 hour 12 minutes.

piscope is written in C and uses alerts via the socket inerface.

x_pigpiod_if2.c (part of the pigpio archive) is written in C gives examples of using alerts via the socket interface.

monitor.py is written in Python and uses alerts via the socket interface.

There are other C socket interface examples and miscellaneous general pigpio examples.

  • Which files i have to import in c++ so i can use it in Qt. Where i can find them? – pooya Mar 2 '18 at 13:44
  • I can't help with that, I have no knowledge of Qt. – joan Mar 2 '18 at 14:29
  • Just i want to know which header files i have to import in my c++ and where are they saved? – pooya Mar 2 '18 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.