🛠 Faire clignoter la LED intégrée (broche 13)

Arduino Leonardo — Board Fiche · debutant · Schéma : IMG-leonardo-debutant-1-leonardo-clignotement-led.svg — Carte Arduino Leonardo alimentée par micro-USB, LED intégrée de la broche 13 (PB7) mise en évidence

Objectives

Discover the Arduino Leonardo board and its ATmega32u4, turn the integrated LED on pin 13 on and off, and successfully perform your first upload via the Caterina bootloader. On the Leonardo, the LED on pin 13 is connected to pin PB7 of the ATmega32u4: no external components are required.

Hardware

Complete code

// LED intégrée de la Leonardo : broche 13 (patte PB7 de l'ATmega32u4)
const uint8_t LED_PIN = 13;

void setup {
  pinMode(LED_PIN, OUTPUT);   // configure la broche en sortie
}

void loop {
  digitalWrite(LED_PIN, HIGH); // LED allumée
  delay(200);
  digitalWrite(LED_PIN, LOW);  // LED éteinte
  delay(800);
}

Expected verification

In the IDE, select Tools > Board > Arduino Leonardo, then the corresponding COM port. During the upload, the port disappears and then reappears: this is normal, as the board restarts after writing (the Caterina bootloader remains active for about 8 s). Once finished, the LED should blink with a short-long rhythm (200 ms on, 800 ms off). Modify the delay values to customize the program.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials