# esp32-wifi-example

> Control an on-board LED via WiFi with a captive portal

- Author: Mikrobot.pl
- Platform: ESP32
- Board: ESP32 Dev Module (`esp32:esp32:esp32`)
- SDK version: 3.3.2
- Tags: #esp32, #example, #captive portal, #wifi
- Created: 2025-12-03
- Updated: 2025-12-03
- Favorites: 5, forks: 8
- Project page (view, flash from the browser, fork): https://flashesp.com/explore/OxdsToAYujBO6cRV1TAnD
- Download all sources (zip): https://flashesp.com/api/public-projects/OxdsToAYujBO6cRV1TAnD/download-sources/

## Source files

- [main.ino (4.3 KB)](https://flashesp.com/explore/OxdsToAYujBO6cRV1TAnD/files/7kLo5AsJKiNA0Ex2oqj3h.md)
- readme.md (937 B)

## README

# ESP32 LED Captive Portal  
### Control an on-board LED via WiFi with a captive portal

This project turns an **ESP32 Dev Board** into a small WiFi-controlled LED module.  
When powered, the ESP32 creates an **open WiFi Access Point** and a **captive portal**.  
As soon as a device connects to the AP, a configuration page appears that lets you **turn the LED ON or OFF**.

---

## ⭐ Features

- **Open WiFi Access Point** (no password)
  - SSID: `ESP32-LED`
- **Captive portal**
  - Any URL request (e.g. `google.com`) is redirected to the LED control page
  - Works with Android / iOS / Windows / Linux
- **Web-based LED control**
  - Simple buttons: **Turn ON** / **Turn OFF**
  - Live status display
- No external network or internet required

---

## 📦 Hardware requirements

- **ESP32 Dev Board** (e.g. ESP32-DevKitC)
- On-board LED or external LED connected to a GPIO pin

Default LED pin in the code:

```cpp
#define LED_PIN 2
