HTTP Server serving a simple webpage which enables to remotely turn LED1 on/off. Compile, download, run and type 'IP_address/secret/' (don't forget the last '/') into your web browser and hit ENTER.

Dependencies:   UIPEthernet

Turn LED1, or other digital output, on/off using a web browser.

In this example we create a HTTP server that will serve a simple Web page to remotely turn LED1, or other digital output on the mbed board, on/off by using a web browser. An inexpensive ENC28J60 Ethernet module is used to assure connection between the mbed board and the Ethernet network (Internet). The ENC28J60 Ethernet module is driven by the UIPEthernet library.

Needed parts:

  • mbed board
  • ENC28J60 Ethernet module
  • Wires
  • Web browser (Internet Explorer, Safari, Firefox, Chrome ...) running on Windows, Mac, Linux, iPhone or Android device.

Notice that DHCP is turned on by default. If you prefer to use static IP address then comment out the line
#define DHCP 1

The IP address assigned to the WebSwitch server along with an instruction how to use it is printed in the connected PC's serial terminal window during program start up.

Check main.cpp for the list of supported mbed platforms.
If you'd like to use an STM32F103C8T6 board then uncomment the line
#define TARGET_STM32F103C8T6 1
and select NUCLEO-F103RB as target for the online compiler.


Please notice that the 3.3V power supply chip (RT8183-B) installed on an STM32F103C8T6 board is not rated to power also the ENC28J60 board.

The project was inspired by the Tuxgraphics Web Switch. Thank you Guido!


Download repository: zip gz

Files at revision 14:810ac368dd6e

Name Size Actions
UIPEthernet.lib 64 Revisions Annotate
main.cpp 9086 Revisions Annotate
mbed-os.lib 77 Revisions Annotate