The first proof a board is alive. On a product this is the power or status lamp.
Bring-upGPIOStatus LEDESP32 family
Official path: examples/get-started/blink
01 Overview
The official Blink example (examples/get-started/blink) toggles one LED to prove GPIO output. It is the minimum heartbeat of any ESP32 board, and the first firmware you run on a fresh board. It verifies that the clock, boot, and GPIO driver are working.
Use when: first bring-up, fixture test, product status lamp.
Skip when: I/O is already proven and you are working on radios or sleep.
Official proves: the configured GPIO can toggle on a fixed period and source/sink enough current.
Official does not: size the resistor, place the lamp in an enclosure, or turn it off in sleep.
Note: the default 1 Hz blink is for validation only; a product must use a state machine to avoid misleading users.
02 Hardware
Chip: any ESP32-class module or DevKit; the example is portable.
Minimum parts: LED + series resistor (often 220Ω–1kΩ, choose based on LED current rating). Some modules have an onboard LED, but often without a series resistor — driving it directly may overcurrent the GPIO.
Pin: BLINK_GPIO in menuconfig. GPIO2 is common on ESP32-DevKit, GPIO8 on many C3 boards. Do not copy blindly.
Power: 3.3V. Do not drive the LED from a 5V pin.
Connection: LED anode to GPIO, cathode via resistor to GND; or anode to 3.3V, cathode via resistor to GPIO (active low). Mind the GPIO sink/source limits.
Production: the lamp must be visible through the housing; silkscreen polarity matters for SMT.
Layout: place the resistor close to the LED, keep traces short to avoid noise pickup.
03 Software flow
1. Select the GPIO in menuconfig or change the Kconfig default.
2. Reset the pin and set it as output.
3. Loop: high → delay → low → delay.
4. Newer trees may drive a WS2812 via RMT/led_strip — that is not a plain GPIO lamp.
5. Product firmware should encode states (boot, connected, error), not blink 1Hz forever.
6. Turn off the LED before deep sleep to avoid leakage.
7. If the LED is on an open-drain pin, add an external pull-up or pull-down.
04 Core points
Pin numbers change by chip. Copying GPIO2 from ESP32 to C3 will miss the lamp.
The DevKit LED is not your product LED. Custom boards need a new footprint.
Do not blink through deep sleep. Status policy is a power decision.
Custom work: status logic, GPIO map, schematic and PCB.
Size the resistor. Different LEDs have different forward voltages and current ratings; connecting directly may burn the LED or the pin.
中文
点亮与上电
Blink 状态指示灯
第一块板活没活,先看这颗灯。量产产品里它就是电源/状态指示。
点亮与上电GPIO状态灯ESP32 family
官方路径: examples/get-started/blink
01 项目概述
官方 Blink 示例(examples/get-started/blink)用一颗 LED 证明 GPIO 输出可用。这是所有 ESP32 硬件的最小心跳,也是新板第一次上电时最先跑的固件。
适用: 新板第一次上电、产测治具、产品状态灯。
不适用: 已经确认 IO 正常、要做通讯或低功耗的阶段。
官方能证明: 配置的 GPIO 能按固定周期翻转,驱动能力正常。
官方没做的: 限流电阻选型、灯的颜色与外壳开孔、低功耗时关掉指示。
注意: 官方示例默认 1Hz 闪烁,只适合验证;产品上必须改成状态机,否则会误导用户。
02 项目硬件描述
芯片: 任意 ESP32 系列开发板或模组,示例代码通用。
最小物料: LED + 限流电阻(常见 220Ω–1kΩ,按 LED 额定电流选)。部分模组板载 LED,但通常没有限流电阻,直接接 GPIO 可能过流。