Let’s connect the thing

Make the following modification to the existing code:
– Declare variables for the connection state, the Timer and the web server URL
– Initialize the network adpater
– Create a Timer to execute code at regular interval.

When the network adpater network address change, update the status of the connection.
Each time the timer event is fired, we create a web API call to get the desired state of the LED.
Congratulation, you made it \o/ Open the web site on any smartphone, tablet or PC. The Switch button should light on/off your device .
Your project should look like this.
For those who want to go a little further and enhance this very simplistic example, I’ll give you some improvement ideas.