ruban-neopixel.ino
WS2812s demand tight timing: the R4 core generates it cleanly via RA4M1 timers. A white head with a colored trail serves as the first addressable-LED test bench on the board.
Hardware
An Arduino UNO R4 Minima (Renesas RA4M1, Cortex-M4 @ 14 MHz, 5 V, 12-bit DAC, no radio) powered by USB or 6-24 V. 1 strip of 16 NeoPixel LEDs + external 5 V supply.
Wiring
Data to D6 through a 330 Ω resistor, VCC to external 5 V, GND common with the R4.
How it works
setPixelColor fills the buffer, show() sends the WS2812 frame in one block. The modulo spins the head along the strip at ~14 Hz.
Running it
Arduino IDE 2.x (with the « Arduino UNO R4 Boards » core installed), pick « Arduino UNO R4 Minima », select the port and Upload. The serial monitor runs at 9600.
Variants
Sync the strip with the DAC (audio output) or the LED matrix (R4 WiFi) for a combined light show.
ruban-neopixel.ino
// Ruban NeoPixel 16 LED sur D6 (Adafruit_NeoPixel sur core R4).
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel ruban(16, 6, NEO_GRB + NEO_KHZ800);
unsigned long t0 = 0;
int tete = 0;
void setup() {
ruban.begin();
ruban.setBrightness(60);
Serial.begin(9600);
}
void loop() {
if (millis() - t0 < 70) return;
t0 = millis();
ruban.clear();
ruban.setPixelColor(tete, ruban.Color(255, 255, 255));
for (int i = 1; i <= 4; i++) {
int pos = (tete - i + 16) % 16;
ruban.setPixelColor(pos, ruban.Color(255 - i * 55, 40, 120));
}
ruban.show();
tete = (tete + 1) % 16;
}
// La trame WS2812 est generee par timers/DMA du RA4M1 :
// le rendu est impeccable meme a pleine vitesse.