Blinky with PlatformIO VS Code on ESP32-C3

Updated on 9 October 2023
dev board ESP32-C3-DevKitM-1
chip ESP32-C3-MINI-1-N4
features blinky led serial esp32c3 platformio
This tutorial is more than 6 months old. If the steps below do not work, then please check the latest versions and the documentations of the individual tools used.

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Pre-requisites

Try these simpler or similar examples:

Buy the components

Code

Download code src/main.cpp
#include <Arduino.h>

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);

  Serial.begin(115200);
  Serial.println("Start blinky");
}

void loop() {
  Serial.println("LED ON");
  digitalWrite(LED_BUILTIN, LOW);
  delay(200);

  Serial.println("LED OFF");
  digitalWrite(LED_BUILTIN, HIGH);
  delay(200);
}

Prototype

A photo of the actual setup.

Blinky with PlatformIO VS Code on ESP32-C3 prototype

Serial console

Serial output from the firmware.

Blinky with PlatformIO VS Code on ESP32-C3 serial console

Description

The on-board LED LED_BUILTIN is GPIO8 as defined in the pin out.

Compile and upload the firmware via the PlatformIO plugin on VS Code.

  1. Create new project with PlatformIO on VS Code editor
  2. Add the project name, board Espressif ESP32-C3-DevkitM-1, and Framework Arduino
  3. Edit file src/main.cpp with blinky Arduino code
  4. Edit platform.ini with configurations
  5. Click Build ✅ to compile the code
  6. Click Upload ➡️ to flash the firmware on the board
  7. Click Serial monitor 🔌 to view the serial prints

References

Watch