clignotante.ino

Arduino UNO R4 Minima · File : clignotante.ino · Language : Arduino · Use case : Faire clignoter la LED utilisateur du R4

The verification blink on the RA4M1: LED_BUILTIN and millis() behave as on AVRs, the USB monitor shows the trace. First test after an upload, before any electronics.

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. No external component.

Wiring

Nothing to wire: the user LED is built in (no LED matrix on the Minima model).

How it works

The loop compares millis() with the last toggle and flips LED_BUILTIN every second, tracing to serial at 9600 baud.

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

On the R4 WiFi, replace with a blink of the internal RGB LED (WS2812 driver) in red/green, or two external LEDs.

clignotante.ino

// Clignotement sur l'UNO R4 : LED_BUILTIN pointe vers la LED
// utilisateur (la LED RGB est pilotee par le WS2812 interne).
const long PERIODE = 1000;

bool etat = false;
unsigned long dernier = 0;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  Serial.println(F("UNO R4 : clignotement demarre"));
}

void loop() {
  if (millis() - dernier >= PERIODE) {
    dernier = millis();
    etat = !etat;
    digitalWrite(LED_BUILTIN, etat);
    Serial.println(etat ? F("ON") : F("OFF"));
  }
}

← Back to the board