Blink the LED on GPIO 22
One board setting — ESP32 Dev Module — and a sketch that names its pin. The on-board LED is on GPIO 22 and lights when the pin is LOW, which is the opposite of most tutorials, and ESP32 Dev Module does not define LED_BUILTIN at all.
Set up the IDE once
Install the ESP32 boards in the Arduino IDE if you have not already — installing the toolchain covers it. Then three rows in the Tools menu:
| Tools row | Set it to |
|---|---|
| Board | esp32 → ESP32 Dev Module |
| Port | The CH340 port: /dev/cu.usbserial-… on a Mac, COM… on Windows |
| Upload Speed | 921600, or 115200 if uploads stop partway |
ESP32 Dev Module is the generic board for a classic ESP32 with 4 MB of flash, which is exactly what this is. The other rows can stay at their defaults.
Upload it
Paste the sketch, press Upload, and watch the bottom of the window. It finds the chip, reports an ESP32-D0WDQ6, writes the sketch and resets the board. The on-board LED should blink twice a second.
LOW is on
The LED is wired so that the pin switches its ground end. Pull GPIO 22 LOW and current flows from 3.3 V through the LED into the pin; set it HIGH and both ends are at 3.3 V, so nothing flows. It is common on small ESP32 boards and it catches everyone once: a sketch that says "turn the LED on at the start" leaves it off.
If the upload stops partway
The log that means "slow down":
Changing baud rate to 921600...
Changed.
A fatal error occurred: The chip stopped responding.The chip was found and talking, so the wiring and the driver are fine. The fast speed is not getting through — usually the cable. Tools → Upload Speed → 115200 and try again.
The code
Blinks the on-board LED twice a second. Nothing to wire: USB-C to the computer is all it needs, with or without a cell.
// Lonely Binary ESP32 LiPo board: blink the on-board LED.
//
// Wiring: none. The LED is on the board, on GPIO 22.
// USB-C -> the computer, for power and the upload
//
// Arduino IDE:
// Tools > Board > esp32 > ESP32 Dev Module
// Tools > Port > the CH340 port (usbserial on a Mac, COM on Windows)
// Tools > Upload Speed > 921600, or 115200 if the upload stops partway
const int LED = 22; // LOW lights it
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, LOW); // on
delay(250);
digitalWrite(LED, HIGH); // off
delay(250);
}The current ESP32 core does not define LED_BUILTIN for ESP32 Dev Module, so the IDE's own Blink example stops with an error. That is why this sketch names 22 itself. LOW is on.
When it does not work
The chip is found, then stops answering at the fast upload speed — esptool says 'The chip stopped responding'. Set Tools > Upload Speed to 115200 and upload again. A shorter cable or a different USB port often lets 921600 work.
The board has no BOOT button; the IDE uses the USB chip to put it into upload mode. If that fails, hold a jumper wire from GPIO 0 to GND, press and release RST, start the upload, and remove the wire once it says Writing.
The IDE's Blink example uses LED_BUILTIN, and ESP32 Dev Module does not define it in the current ESP32 core. Replace LED_BUILTIN with 22, or use the sketch on this page.
The sketch drives pin 2, as many ESP32 tutorials do, because that is where a DevKit v1 has its LED. This board has nothing on GPIO 2. Change the pin number to 22.
That is a cable, a driver or the way up the USB-C plug is. The next article takes them in that order.
A cable, a driver, or a USB-C plug that works one way up.
When the port will not appear →Edit this page — content/books/esplipo/blink-gpio-22.mdx
Questions about this product
See what other owners have asked, and read their solutions.
ESP32 LiPo Dev Kit: 3 Boards with LiPo Charger + 3 Shields
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.