Blinky with Arduino on ESP32-C3

dev board ESP32-C3-DevKitM-1
chip ESP32-C3-MINI-1-N4
features blinky led serial esp32c3

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 blinky-arduino-esp32c3.ino
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);

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

void loop() {
  ledON();
  delay(200);

  ledOFF();
  delay(200);
}

void ledON() {
  Serial.println("LED ON");
  digitalWrite(LED_BUILTIN, LOW);
}

void ledOFF() {
  Serial.println("LED OFF");
  digitalWrite(LED_BUILTIN, HIGH);
}

Makefile

BOARD?=esp32:esp32:esp32c3
PORT?=/dev/cu.SLAB_USBtoUART*
BUILD=build

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) --output-dir $(BUILD) ./

flash:
	arduino-cli upload --fqbn $(BOARD) --port $(PORT) --input-dir $(BUILD)

clean:
	rm -r build

Prototype

A photo of the actual setup.

Blinky with Arduino on ESP32-C3 prototype

Arduino IDE settings

Ensure the following IDE settings before flashing.

Blinky with Arduino on ESP32-C3 Arduino IDE settings

Serial console

Serial output from the firmware.

Blinky with Arduino 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 Arduino IDE or arduino-cli with Makefile.

References