Web-Controlled LED

This is a minimal project which just requires a Wemos Mini D1, and no other hardware. The goal is to allow you to control the state of the LED with your local browser.

Hardware

The hardware for this project is simple:

  • 1 x WeMos Mini D1 - Approximately €2.50.

We're only controlling the on-board LED, so we don't need any additional hardware, or wiring.

Software

The software for this project is very straight-forward:

  • Connected to your local WiFi network, obtaining an IP address via DHCP.
  • Start a web-server on port 80.
  • For each incoming request:
    • If it is a request to enable/disable the LED, do that.
    • Reply with the current state of the LED.

The Code

The complete code looks like this:

Download the code.