Hello. I've got Arduino sending data to a mysql database on a server using Arduino Uno, a GSM shield and a sensor but I'd like to request data to Arduino from a Php file every 30 minutes at a given time. How could it be done ?.
Thanks in advance.
What do you mean by "from a PHP file"? Normally a php file has php code. Why would you want that on an Arduino?
If you have a web server program written using PHP then the Arduino can send a GET request and the server will send back data.
You need to explain your requirement more clearly.
...R
I'm sorry I was not clear. What I have is a database on a server and a php that collects the data sent by Arduino and stores them in this database. The idea now is for a php to request Arduino a data at a certain time and every x minutes and this data send it to a database. It is as if Arduino becomes passive, it only collects data through the sensor and stores them in a variable. Control Arduino from a server.
In general a server cannot send data to a client - the request must come from the client. Imagine all the trash you would be receiving every minute if they could.
To be honest I think the simplest solution for your situation is for the Arduino to make regular calls to the server. The message that is sent back could include a code value that the Arduino can interpret and know to send some special item in the next call to the server.
Even simpler, I think if this was my project I would just get the Arduino to send all the data every time even if it had not changed and use the much greater computing power on the PC to make sense of it.
...R
Perfect. I will study the proposed solutions in order to adapt the current code. Thank you very much for your help.