🛠 Faire clignoter la LED RGB native sur GPIO48

ESP32-S3 · debutant · Schéma : IMG-esp32-s3-debutant-1-esp32-s3-rgb-gpio48-blink.svg — Carte ESP32-S3 (DevKitC-1 v1.1, XIAO ou T-Display) avec un pixel adressable WS2812 câblé sur GPIO48, broche signalée, câble USB vers l'ordinateur.

Objectives

Discover the ESP32-S3 (dual-core Xtensa LX7 up to 240 MHz, Wi-Fi 2.4 GHz + Bluetooth 5 LE) with your first program: controlling the addressable WS2812 RGB LED that most boards embed on GPIO48 (DevKitC-1 v1.1, Seeed XIAO ESP32S3, LILYGO T-Display-S3). You will learn how to install the Espressif core in the Arduino IDE, how to choose the correct board type, and why an "RGB" LED on paper is actually an addressable LED controlled by a serial protocol, rather than by three pins.

Hardware

Complete Code

// WS2812 embarque sur GPIO48 (DevKitC-1 v1.1, XIAO, T-Display-S3)
#include <Adafruit_NeoPixel.h>
#define LED_PIN 48
#define N_LED   1

Adafruit_NeoPixel px(N_LED, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup {
  px.begin;
  px.setBrightness(40);          // limiter le courant dans le pixel
}

void loop {
  static uint32_t c = 0;
  c += 0x10101;                  // rampe lente de couleur
  px.setPixelColor(0, c);
  px.show;                     // trame RMT vers la LED
  delay(50);
}

Expected Verification

After uploading (board type "ESP32S3 Dev Module", USB CDC enabled), the embedded pixel continuously cycles through a smooth color ramp. No wiring is necessary: the WS2812 chip is already powered at 3.3 V and connected to GPIO48. If your board has multiple pixels (some T-Display models), change N_LED to 2 or 3.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials