I have a dual H bridge connected to my Pi for controlling 2 brushed DC motors with.
I intend to have a web interface to control the speed of the motors. I'm thinking of a HTML page submitting AJAX requests to a PHP file. I'm a web developer so I've already installed Nginx and PHP on the Pi.
My problem is that I want the motors running most of the time, the AJAX requests are to change the motors speed and direction. This doesn't seem suited to a PHP file as it's designed for the HTTP request-response cycle, a single PHP script is not designed to execute indefinitely waiting for input.
What's the best approach to solve this? Will I need to have a Python script running in the background generating PWM and have some sort of communication between the python script and the PHP file? Is this possible?