🛠 Faire clignoter la LED RGB de l'Esplora

Arduino Esplora — Board Fiche · debutant · Schéma : IMG-esplora-debutant-1-esplora-clignotement-rgb.svg — Vue de dessus d'une Arduino Esplora avec la LED RGB mise en évidence et les broches internes D5 (rouge), D10 (verte) et D9 (bleue) annotées.

Objectives

Discover the Arduino Esplora board by controlling its integrated RGB (red/green/blue) LED. By the end of this tutorial, you will know how to install the Esplora library, upload a first sketch, and drive the three PWM channels of the color LED without soldering or wiring anything — that is the main advantage of this "game controller" board derived from the Leonardo (same ATmega32u4).

Hardware

Complete Code

/* Clignotement arc-en-ciel de la LED RVB de l'Esplora.
   La LED est câblée en interne : rouge = D5, verte = D10, bleue = D9 (PWM).
   La bibliothèque Esplora fournit writeRGB(r, v, b) : 0 = éteinte, 255 = plein. */
#include <Esplora.h>

void setup {
  // Rien à configurer : la bibliothèque gère les broches en interne.
  Esplora.writeRGB(0, 0, 0);        // LED éteinte au démarrage
}

void loop {
  Esplora.writeRGB(255, 0, 0);      // rouge
  delay(400);
  Esplora.writeRGB(0, 255, 0);      // vert
  delay(400);
  Esplora.writeRGB(0, 0, 255);      // bleu
  delay(400);
  Esplora.writeRGB(255, 255, 0);    // jaune (rouge + vert)
  delay(400);
  Esplora.writeRGB(0, 0, 0);        // extinction
  delay(400);
}

In the IDE, make sure to select the Arduino Esplora board (FQBN arduino:avr:esplora) and then upload.

Expected Verification

The RGB LED on the board alternates red → green → blue → yellow → off every 400 ms. The yellow "L" LED (pin 13) remains off: it is not used here. If you replace 255 with 30, the light becomes dim — pins D5/D9/D10 are PWM outputs, so brightness is progressive.

Common Errors

  1. Wrong board selected: Choosing "Arduino Leonardo" instead of "Arduino Esplora" works for the core (leonardo variant) but you will lose the dedicated examples; always choose Esplora.
  2. Missing library: fatal error: Esplora.h: No such file or directory → install the "Esplora" library (arduino-libraries) via the IDE.
  3. LED appears "off" in dark red: At full brightness, the red LED may appear on even when it receives 0; verify actual extinction with writeRGB(0,0,0) in the dark.
  4. Serial port not found: The Esplora uses native USB (CDC, VID 0x2341 PID 0x803C); on Windows, you may need the .inf driver provided with the core. If a sketch crashes at startup, press Reset and upload within the approximately 8-second window of the Caterina bootloader.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials