ESP32-C3 Beetle - Dev Environment Setup
Let's setup our developer environment so we can start flashing code to our ESP32-C3 beetle development board.
🥳
There are a few different ways you can setup a development environment for your ESP32-C3 Beetle.
Arduino IDE (nope)
You could install the Arduino IDE, which you can use to write, compile and upload code to Arduino boards and other microcontrollers like this ESP32.
It's great for beginners, but you can't create folders. You can create individual .ino files (main file used for writing Arduino programs), but they all get merged at compile time. So you can't separate projects.
PlatformIO (yep)
I chose to go with PlatformIO, which is an extension for VS Code that also lets you write, build, and upload code to microcontrollers.
My preferred IDE is Cursor (VS Code under the hood with AI features built-in). Anything that works with VS Code works with Cursor.
PlatformIO is better than Arduino IDE for more complex projects (or in general imo), because you can organise your files and projects with folders.
You also get all the benefits of autocomplete, syntax checking etc.
You can also install different libraries for each of your individual projects. Whereas in Arduino IDE, you install them all globally which can create conflicts when you start working on a different project. You'd need to uninstall the libraries for your previous project first, and you can't switch between them.
Install PlatformIO in VS Code (or Cursor)
1. Open VS Code or Cursor.
2. Go to the extensions panel (left sidebar, or "View" > "Extensions" in the toolbar).
3. In the search bar, type: "PlatformIO IDE". You'll see the official PlatformIO extension by PlatformIO Labs.
4. Click the "Install" button. It'll take a minute for it to setup all the compilers and tools in the background.
Create your first PlatformIO project
After you have installed PlatformIO, click the new "PlatformIO icon" (ant head logo) in your sidebar. From there, you'll be able to create new projects, and manage boards & libraries etc.
You'll see a page like this, where you can click "Create new Project":

Next, give your project a name and choose your development board, which is the DRRobot Beetle ESP32-C3 in this case.
I called the project "beetle_c3_blink", because I'll be making the onboard LED light blink for my first beetle project.
The framework will automatically be chosen depending on the board you pick, in this case it's set to Arduino.
You can leave the "Use default location" checked if you want the project to be stored in your docs folder under PlatformIO. I chose to store mine in a personal development project folder elsewhere.
Standard PlatformIO project structure
When you create a PlatformIO project, it'll automatically create this folder tree for you:

It'll also download and setup compilers, tools and frameworks in the background.
Write your first ESP32 Program - blinky LED
For this first program, all we're going to make the onboard LED on the Beetle blink.
Let's start with the code.
1. Write blinking LED code
PlatformIO will have created a main.cpp file in the /src folder. It will have added basic setup() and loop() functions which you'll use as the starting point for your blink code.
Replace the code in that file with this:
1#include <Arduino.h>
2
3#define LED_PIN 10 // Onboard LED is GPIO 10 on Beetle ESP32-C3
4
5void setup() {
6 pinMode(LED_PIN, OUTPUT);
7}
8
9void loop() {
10 digitalWrite(LED_PIN, HIGH);
11 delay(500);
12 digitalWrite(LED_PIN, LOW);
13 delay(500);
14}The setup() function runs one when the board powers up. We've used it to set GPIO 10 as the output (GPIO 10 is the pin that the onboard LED is connected to).
The loop() function repeats forever while the board is running. In this case, we turn the LED on, and off every 500ms (half a second).
2. Connect your beetle
Plug your ESP32-C3 beetle into your computer with a USB-C cable.
3. Build your project
In VS Code's bottom bar, click the checkmark icon. This will compile (build) your code.
Wait until you see "SUCCESS" in the terminal output before you continue.

4. Flash (upload) the code
Next to the checkmark icon, there will be a Right Arrow icon. Click that to upload the code to your Beetle.
Once you've done that, you'll see the onboard LED on your Beetle start to blink every half a second.
🌯 That's a wrap for writing a hello-world LED blinking program for your Beetle-C3!
