led_rgb.ino
The Nicla Vision RGB LED is driven by core macros: LEDR (pin 23), LEDG (24, also LED_BUILTIN) and LEDB (25). This sketch scrolls red, green, blue, yellow, white — the board baseline visual test.
Hardware
An Arduino Nicla Vision (STM32H7 M7+M4, 23×23 mm) with GC2145 camera, LSM6DSOX IMU, PDM mic, ToF (VL53Lx), ESP32 Wi-Fi/BLE module and RGB LED (LEDR/G/B). No parts: the RGB LED is on-board, visible on the edge of the 23×23 mm card.
Wiring
No wiring. The three channels are driven on-off by pins 23/24/25; the core names them LEDR, LEDG, LEDB.
How it works
Each color is a boolean combination of the three channels via digitalWrite. Docs note: LEDG also doubles as the M4 core heartbeat — turning it off can hide that signal.
Running it
Programmed from the Arduino IDE (ArduinoCore-mbed, NICLA_VISION target) over USB-C; Camera, PDM, Arduino_LSM6DSOX, WiFiNINA and ArduinoBLE libraries provided.
Variants
Fade colors in RGB (3× analogWrite if the core allows on these pins), map a system state (BLE connected = blue), or wire an external NeoPixel on a logic pin.
led_rgb.ino
// Nicla Vision : LED RGB embarquée, macros du core :
// LEDR = broche 23, LEDG = 24 (= LED_BUILTIN), LEDB = 25.
// LEDG est aussi le battement du coeur Cortex-M4 (bootM4).
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // LEDG (24)
pinMode(LEDG, OUTPUT);
pinMode(LEDR, OUTPUT);
pinMode(LEDB, OUTPUT);
}
void couleur(bool r, bool g, bool b) {
digitalWrite(LEDG, g);
digitalWrite(LEDR, r);
digitalWrite(LEDB, b);
}
void loop() {
couleur(true, false, false); delay(500); // rouge
couleur(false, true, false); delay(500); // vert
couleur(false, false, true); delay(500); // bleu
couleur(true, true, false); delay(500); // jaune
couleur(true, true, true); delay(500); // blanc
couleur(false, false, false);delay(500); // éteinte
}