ESP32-C3 Beetle - Blinking an External LED
In the previous post, we learned how to flash our first hello-world program to our Beetle-C3: To blink the onboard LED. Next, we're going to do the exact same thing with an external LED.
You Will Need:
- 1 x
ESP32-C3 Beetle Development Board
- 1 x
LED (Light-Emitting Diode)
- 1 x
Breadboard
- 2 x
Jumper Wires
- 1 x
Resistor (typically 220Ω to 330Ω).
We'll be using the exact same code we wrote when blinking the onboard LED on our Beetle. The only thing we'll change is the pin number.
1. Attach Beetle to Breadboard
Your Beetle will have come with two strips of male header pins. In my case, there were two more pins in the strip than there were holes along the side of the Beetle (10 pins, 8 holes).
Use a pair of pliers to snap two of the pins off.

To attach your Beetle to the breadboard, you can push the strip of pins through the holes on either side of your beetle.
Then plug your Beetle into the breadboard so that it straddles the gap running vertically down the middle of your
Breadboard.

Your Beetle needs to straddle the middle gap of your breadboard, so that the pins on either side each have their own row (rails that are not electrically connected to each other).
2. Connect your LED
Next, add your
LED (Light-Emitting Diode) to the board. You want the long leg of the LED (anode) to be in one row, while the shorter leg (cathode) is in another row. The two will be parallel to the middle gap.
3. Connect your resistor
Connect one end of the
Resistor to the cathode (short leg) of your LED.
Then connect the other end of the resistor to a GND pin on the Beetle using a
Jumper Wires.
4. Connect a GPIO pin to your LED
Next, choose a digital output pin (e.g. GPI20) on your Beetle.
Use a
Jumper Wires to connect the GPI20 to the anode (long leg) of the LED.
5. Build & Compile your code
Next, write the code to blink your external LED on and off.
You can use the exact same code for blinking the onboard Beetle LED. All you need to change is the pin number, to LED in this case. That post will also show you how to setup your dev environment if you haven't done that already.
This is what the code will look like to blink your LED on and off every half second:
1#include <Arduino.h>
2
3int led = 20;
4
5void setup() {
6 pinMode(led, OUTPUT);
7}
8
9void loop() {
10 digitalWrite(led, HIGH);
11 delay(500);
12 digitalWrite(led, LOW);
13 delay(500);
14}6. Plug your Beetle in
Finally, plug your Beetle into your computer using the USB-C wire. Build your code and upload it to your board.
Here is what this looks like when done!
Woo hoo congrats! You learned how to build your first electronics project!!!
🥳