GitHub hosted
Public


Download repository: zip

This example is to execute a web server on NuMaker IoT board, access it with a browser to display the web page, and toggle the board LED by pressing the button on browser.

The code is derived from https://os.mbed.com/teams/sandbox/code/http-webserver-example/

  • Updated code to use Mbed OS 6
  • Added static IP option
  • Support for these NuMaker IoT boards with built-in Ethernet, such as NuMaker-IoT-M487, NuMaker-PFM-M487, NuMaker-IoT-M467, etc.

Static IP address or DHCP


If you want to specified a static IP address for Ethernet, set as follows in main.cpp

#define STATIC_IP   1

and assign the IP address, network mask, default gateway address to (for example)

#define IP_ADDRESS      "169.254.108.2"
#define NETWORK_MASK    "255.255.0.0"
#define GATEWAY_ADDRESS "169.254.108.1"

If you want to use DHCP to obtain IP address, please set

#define STATIC_IP   0

Content of Web pages


The content of the web pages are generated by request_handler() in main.cpp, modify the code to meet your needs.