🛠 Faire clignoter la LED de l'Arduino Due et apprivoiser ses deux ports USB

Arduino Due · debutant · Schéma : IMG-due-debutant-1-clignoter-led-due.svg — Arduino Due vue de dessus, LED L (broche 13) surlignée près du connecteur JTAG, les deux connecteurs micro-USB « Programming » (16U2) et « Native » (SAM3X) annotés, badge d'avertissement 3,3 V.

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

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

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials