🛠 Allumer une LED externe en respectant les broches 3,3 V et 9 mA de la Due

Arduino Due · debutant · Schéma : IMG-due-debutant-3-led-externe-resistance-3v3.svg — Arduino Due, broche 9 reliée via une résistance 100 Ω à une LED rouge dont la cathode va à GND, encart de calcul (3,3 V − 2 V)/10 mA ≈ 130 Ω et rappel des groupes 9 mA / 3 mA.

Objectives

Move away from all-in-one setups: wire an external LED to a Due pin by correctly calculating the resistor. On a 5 V board, you can take "220 Ω with your eyes closed"; on the Due, the logic is at 3.3 V AND the current per pin is much lower than on AVR chips: 9 mA for group 1, 3 mA for group 2, and 130 mA total across all I/O pins. This tutorial establishes good electrical practices.

Hardware

Complete code

// LED externe sur la broche 9 (groupe 1 : 9 mA max par broche)
const uint8_t LEDX = 9;

void setup {
  pinMode(LEDX, OUTPUT);
}

void loop {
  digitalWrite(LEDX, HIGH);   // 3,3 V sur la broche -> LED allumée
  delay(300);
  digitalWrite(LEDX, LOW);    // 0 V -> LED éteinte
  delay(300);
}

Resistor calculation: R = (Vpin − Vf) / I. For a red LED at 3.3 V: (3.3 − 2.0) / 0.010 A ≈ 130 Ω → use 150 Ω, the LED will see ~9 mA and the pin will stay within its 9 mA limit. With 220 Ω it is even more conservative and perfectly visible.

Expected verification

The LED blinks every 300 ms. If you disconnect the resistor, the LED shines brighter, but you are injecting uncontrolled current: never leave it in this state. The program runs autonomously on 7–12 V jack power, with USB disconnected.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials