🛠 Faire clignoter la LED embarquée (et comprendre les LED TX/RX)
Objectives
Make the Arduino Micro's onboard LED blink and understand a specific feature of the Micro: the TX/RX LEDs near the USB port indicate USB (CDC) traffic, not the state of pins 0/1 as on an Uno.
Hardware
- 1 Arduino Micro (ATmega32U4, Caterina bootloader)
- 1 micro-USB data cable (not a "charger" cable)
- No external components: the LED is on pin 13 (LED_BUILTIN)
Complete Code
// Clignotement de la LED embarquee (broche 13) sur Arduino Micro.
// Les LED TX/RX pres du connecteur USB suivent le trafic USB,
// pas digitalWrite : elles ne pilotent aucune broche.
void setup {
pinMode(LED_BUILTIN, OUTPUT); // broche 13
}
void loop {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
Expected Verification
The LED on pin 13 blinks twice per second as soon as the upload finishes, even with the Serial Monitor closed. If you add Serial.begin(9600) and Serial.println calls, the TX/RX LEDs will also light up: this is CDC traffic, not pin 1.
Common Errors
- Selecting the "Arduino Uno" board instead of "Arduino Micro": the upload fails because the Micro programs via the USB Caterina bootloader (AVR109 protocol).
- Confusing the TX LED with pin 1: the TX LED reflects USB activity. >
- Using a charge-only micro-USB cable: no COM port appears.
- On Windows, an .inf file is required for the CDC port.
Other tutorials for this board
- Lire un bouton avec une résistance de pull-up interne
- Lire un capteur analogique sur le convertisseur 10 bits
- Transformer le Micro en clavier USB (HID) avec bouton de sécurité
- Pont Serial vers Serial1 : passerelle USB vers TTL
- Piloter un servo moteur avec le PWM et un potentiomètre
- Sortir des sentiers : registres AVR et interruption externe
Code examples for this board
clignotante.inoArduinobouton-led.inoArduinoclavier-auto-tape.inoArduinosouris-cercle.inoArduinotelecommande-media.inoArduinobouton-clic-souris.inoArduino