Let’s connect the thing

Add a “System.Http” reference to the Gadgeteer project.

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.

When the button is pushed, we make an web API call to update the state of the LED on the server.

Add a “LightOn” property. Each time we change its value, the LED module is updated

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.