Day 12: Autonomous webserver
The results of yesterday’s experiment are now to be used in an autonomous program. Today’s program not only sends a simple website to the browser, but also permits control of an LED.
Behind today’s door, you will find a 9-V battery clip that can make your board mobile. As an alternative, you may also use a Power Bank (a battery pack usually used for mobile phones). If you want to use the 9-V-battery, observe that the red wire must be connected to Vin, and the black one to GND. The figure shows the setup of today’s experiment with external power supply.
The program: Day12_TCPServerLed
Today’s program sends a slightly more complex page than the previous experiment. You can also switch the LED at pin D9 by entering /LED behind the IP? of the module. The current condition of the LED is then inverted, i.e. toggled each time.
Enter the WLAN data and upload the program. The board’s IP is displayed in serial mode. Then you can open the browser and call the board’s IP. The website now has a headline and a little more text. The text indicates how to control the LED. It is a first, fully autonomous web server.