A complete beginner-friendly guide to setting up your board and uploading your first program
The ESP32 is a powerful, low-cost microcontroller with built-in Wi-Fi and Bluetooth, widely used in IoT (Internet of Things) projects. Before you can write and run programs on an ESP32-based board — such as the popular Adafruit Feather HUZZAH32 — you need to prepare your computer by installing the Arduino IDE and adding ESP32 support to it.
The Arduino IDE (Integrated Development Environment) is the software you use to write, compile, and upload code to your ESP32 board. If you already have it installed, you can skip this step.
By default, the Arduino IDE only supports official Arduino boards. To add support for ESP32-based boards, you must tell the IDE where to find the ESP32 board definitions by adding a special URL into the Preferences window.
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Once the URL is added, the Arduino IDE knows where to download ESP32 board definitions from. Now you need to actually install the package using the Board Manager.
While the ESP32 package is downloading, you can connect your board to your computer using a micro-USB cable. Most ESP32 boards use a USB-to-serial bridge chip (commonly the Silicon Labs CP210x) to communicate with your PC.
After installation, you need to tell the Arduino IDE exactly which ESP32 board you are using and which COM port it is connected to.
Every Arduino/ESP32 program (called a "sketch") is built from two essential functions:
Runs only once when the board powers on or resets. Used for initialization — setting pin modes, starting Wi-Fi, configuring sensors, etc.
Runs repeatedly forever after setup() finishes. This is where your main program logic lives — for example, reading sensors and sending data continuously.
Imagine you're building a cloud-connected temperature logger. Connecting to Wi-Fi and initializing
the sensor only needs to happen once, so it goes in setup(). But reading the
temperature, sending it to the cloud, and waiting a few seconds needs to repeat forever, so that
logic goes in loop().
Let's write a simple program to blink the onboard LED (connected to Pin 13) on and off. This is the traditional "Hello World" of embedded programming.
void setup() {
pinMode(13, OUTPUT); // Set pin 13 as an output
}
void loop() {
digitalWrite(13, HIGH); // Turn LED ON
delay(2000); // Wait 2 seconds
digitalWrite(13, LOW); // Turn LED OFF
delay(2000); // Wait 2 seconds
}
Try changing the delay value from 2000 milliseconds to 500
milliseconds and re-upload the sketch. You'll notice the LED blinks much faster, since the
program now waits only half a second between each on/off cycle.
void loop() {
digitalWrite(13, HIGH);
delay(500); // Faster blink: 0.5 second ON
digitalWrite(13, LOW);
delay(500); // Faster blink: 0.5 second OFF
}
| Delay Value | Blink Behavior |
|---|---|
| 2000 ms | LED ON for 2s, OFF for 2s (slow blink) |
| 500 ms | LED ON for 0.5s, OFF for 0.5s (fast blink) |
You have now successfully installed the Arduino IDE, added ESP32 board support, connected your board, verified drivers, and uploaded your first program. This foundational setup is the starting point for all future ESP32 projects — from simple LED blinking to complex IoT applications involving sensors, Wi-Fi, and cloud connectivity.