🛠 Faire clignoter la LED de l'Arduino Due et apprivoiser ses deux ports USB
Objectives
Discover the Arduino Due, the first 32-bit Arduino board: Atmel/Microchip AT91SAM3X8E microcontroller (Cortex-M3 at 84 MHz, 512 KB flash, 96 KB SRAM), 3.3 V logic, Mega form factor. You will upload your first program, blink the onboard LED, and understand this board's key feature: it has TWO independent micro-USB connectors.
Hardware
- 1 Arduino Due board (SKU A000062) or clone
- 1 micro-USB data cable
- PC with Arduino IDE (core "Arduino SAM Boards" installed via the Board Manager) or arduino-cli
- Official safety reminder: pins tolerate 3.3 V maximum — never send 5 V to a pin, or you will destroy the board.
Complete Code
// Blink Due — LED intégrée broche 13 + message sur les DEUX ports série
const uint8_t LED = 13; // LED « L » de la Due
void setup {
pinMode(LED, OUTPUT);
Serial.begin(115200); // port Programming (pont 16U2, PID 0x003D)
SerialUSB.begin(115200); // port Native (CDC du SAM3X, PID 0x003E)
}
void loop {
digitalWrite(LED, HIGH);
delay(250);
digitalWrite(LED, LOW);
delay(750);
Serial.println("bonjour via port Programming");
SerialUSB.println("bonjour via port Native");
}
In the IDE: Tools > Board > Arduino Due, then choose "Arduino Due (Programming Port)" or "Arduino Due (Native USB Port)" depending on which cable is connected, and click Upload. The upload uses bossac (sam-ba protocol) with a 1200 baud command that resets the board into bootloader mode.
Expected Verification
The "L" LED blinks (250 ms ON / 750 ms OFF) as soon as the upload finishes. The Serial Monitor displays your messages only if you have opened the port corresponding to the connected cable: the Programming port and the Native port are two distinct serial ports. The program continues to run once USB is disconnected (powered by the 7–12 V jack).
Common Errors
- Choosing the wrong port: the code uses
Serial.printlnbut the cable is on the Native port (or vice versa) — the monitor remains frustratingly empty. This is beginner pitfall #1 on the Due. - Forgetting to install the "Arduino SAM Boards" core: the "Arduino Due" board does not appear in the IDE.
- On clones, the Native port is sometimes non-functional (generic USB chip): upload via the Programming port.
- Poor quality micro-USB cable (charge-only): no port appears; check with another cable.
- Confusing it with a 5 V board: the Due uses 3.3 V logic and its pins deliver only 9 mA (group 1) / 3 mA (group 2) — no LED without an appropriate resistor.
Other tutorials for this board
- Lire un potentiomètre avec le vrai ADC 12 bits de la Due
- Allumer une LED externe en respectant les broches 3,3 V et 9 mA de la Due
- Générer une vraie tension analogique avec les DAC 12 bits (broches 66 et 67)
- Dialoguer avec un GPS (ou tout module TTL) sur Serial1 sans bloquer la boucle
- Scanner les deux bus I2C de la Due (Wire sur 20/21, Wire1 sur 70/71)
- Monter la Due sur un bus CAN 500 kbit/s avec un transceiver externe
Code examples for this board
clignotante.inoArduinobouton-led.inoArduinodac-onde.inoArduinoadc-12-bits.inoArduinopwm-12-bits.inoArduinogps-serial1.inoArduino