0

Is there a way to use PHP instead of python to detect callback from a GPIO pin? I see you can use shell_exec to execute a pin but not read output in real-time. An example is using a vibration sensor and detecting that sensor in real-time using ajax so I can see when the sensor vibrates via my browser hence the need for php.. I do not want to use a GUI library as I am most familiar with php.

2

Take a look at phpi, it allows event binding to GPIO and is written in pure PHP.

There's also an example to interface realtime via WebSockets which should solve the problem nicely.

Disclosure: I am the author of the library

0

There is currently no library to use PHP to manipulate the GPIO in that manner. I've seen one basic library, but it doesn't support using callbacks.

I would recommend using Python for this portion of your backend.

  • Ya thats what im using now, just not familiar with it enough..with php I can add users and expand the game easily.. – Ryan D May 11 '16 at 22:54

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.