We want to achieve that we can tell our IoT how to set its outputs and we want to receive sensor values acquired by our IoT project. We want to do this with a PHP program that is optimized for mobile phones. Basically is the Arduino the webserver and the PHP program is the client.
Outputs
Upload this ESP13-1 sketch and when uploaded open the Serial Monitor. Next try 192.168.2.4:9000?switch1=on&switch2=aut& in the browser of any computer on your LAN. You will receive the entire GET request in your Arduino Serial Monitor. It should look something like this:
GET /?switch1=on&switch2=aut& HTTP/1.1
Host: 192.168.2.3:9000.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
This is basically how an µcontroller (IoT project) receives data (=commands) from a web page using this shield.
Inputs
Now we also want to return an answer from our IoT project to the calling website. To do so first upload this ESP13-2 sketch. Then you can open the ESP13-2.php page. So through this site you can switch on/off a light at our office and read our sensors. |