Hardware Reference
In-Depth Information
Next, we can close the connection if the client is not connected to the server anymore:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
}
We are also going to repeat the whole loop every second:
delay(1000);
Note
You can find all the code for this section in the GitHub repository of this chapter:
Now, if we just uploaded the code to the Arduino board, not much would have happened,
since we didn't do anything on the server side. The Arduino board would make the re-
quest, but as the request file doesn't exist on the server, the server would return an error
code.
So first, we need to build a file on the server that will handle the request from the board
and log the data somewhere. That's exactly what we are going to do next.