clignotante.ino

Arduino Portenta H7 · File : clignotante.ino · Language : Arduino · Use case : Faire clignoter la LED et parler au moniteur USB-C

The getting-started blink on the Portenta H7: the Arduino Mbed core hides the dual-core STM32H747 complexity. The serial monitor runs over USB-C; the core executes on the 480 MHz Cortex-M7.

Hardware

An Arduino Portenta H7 (ST STM32H747 dual-core module Cortex-M7 @ 480 MHz + M4 @ 240 MHz, 8 MB SDRAM, high-density connector), powered by USB-C or 5 V. No external component.

Wiring

Nothing to wire for the LED. Power over USB-C or 5 V on the module connector.

How it works

millis() rides the M7 SysTick; digitalWrite drives the LED through the Mbed HAL. The monitor waits for the port to open for 3 s at boot.

Running it

Arduino IDE with the « Arduino Mbed OS Portenta Boards » core: pick « Portenta H7 » (M7 core), the USB-C port, then Upload. The DFU mode M7/M4 selector also loads the M4 core.

Variants

Move the workload to the M4 core (see the RPC example) to spare the M7, or drive the RGB LED of a carrier board.

clignotante.ino

// Portenta H7 : blink + Serial USB-C (connecteur Type-C).
const long PERIODE = 500;

bool etat = false;
unsigned long dernier = 0;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);          // lien CDC sur le port USB-C
  while (!Serial && millis() < 3000);
  Serial.println("Portenta H7 prete (Cortex-M7 @ 480 MHz)");
}

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

← Back to the board