When I POST data to a PHP script it must wait for the data to be saved before the loop function will continue. The problem with this is that buttons on my device don’t work while it’s tied up. I need a way to continue POST data and have my buttons work at the same time. Any help about how to do this would be greatly appreciated.
You could make your buttons interrupt driven, but can you also show your code how you do the waiting?
And what do you mean with
Thanks for the info. I had no idea that was even such a thing as interrupt pins. Just looked at it and I think that’ll probably fix my issue. Are all pins on the Photon able to be interrupt “mode”? It seems regular ol’ Arduino only has 2.
I’m on my phone at the moment so I’ll send that code later. I should have clarified that more. I just mean that the loop can’t proceed until the PHP script has completely executed (i.e. data is saved in the DB). It’s too long of a process in that it doesn’t allow the buttons to be used until it’s complete. Again, I think that making the buttons interrupt driven will fix that.
I guess my question I’m still curious though: is there a way to keep the loop() function looping and continually check to see if the POST has been completed instead of waiting for it to complete before proceeding through loop()?
Instead of having your Photon call the PHP script directly (via HttpClient, I presume) just use the Particle Publish feature. Then install a webhook to listen for that publish and relay it to your PHP script. I do it all the time.
I’m making an assumption that your PHP script is on a publicly accessible web server.