🛠 Clignotement d'une LED sur l'Arduino Mega ADK

Arduino Mega ADK (Rev3) · debutant · Schéma : IMG-mega-adk-debutant-1-mega-adk-clignotement-led.svg — Mega ADK, LED + résistance 220 Ω entre la broche 13 et GND, câble USB vers l'ordinateur

Objectives

Get started with the Arduino Mega ADK (Rev3, SKU A000069) as a simple microcontroller board: turn an LED on and off at regular intervals. This first workshop does not involve the MAX3421E USB host port or the Android Accessory (AOA) protocol — it verifies that the board is alive, that the bootloader responds, and that you have selected the correct board in the IDE ("Arduino Mega ADK", core id megaADK, same computing core as the Mega 2560: ATmega2560 at 16 MHz, 256 KB of flash with 253,952 bytes usable, 8 KB of SRAM). The board is officially retired (end of life): these workshops are intended to keep it running as is.

Hardware

Note specific to this board: never use digital pin 7, which is reserved for the MAX3421E RST (official page: "Please do not use Digital pin 7 as input or output because is used in the communication with MAX3421E").

Complete Code

// mega-adk-clignotement-led.ino
// Board: "Arduino Mega ADK" (Outils > Type de carte)
const byte LED = 13;          // LED intégrée « L » sur la broche 13

void setup {
  pinMode(LED, OUTPUT);
  Serial.begin(9600);         // console via l'ATmega8U2 (puce USB-série)
}

void loop {
  digitalWrite(LED, HIGH);
  Serial.println(F("LED ON"));
  delay(500);
  digitalWrite(LED, LOW);
  Serial.println(F("LED OFF"));
  delay(500);
}

Expected Verification

The LED blinks every 500 ms as soon as the bootloader finishes (STK500v2 protocol, identical to the Mega 2560). Opening the serial console at 9600 baud displays "LED ON" / "LED OFF" alternately. Warning: the DTR auto-reset when opening the serial port causes the loss of the first bytes — wait ~1 s after opening before concluding that "nothing is being sent".

Common Errors

  1. Wrong board selected: choose "Arduino Mega ADK" in the IDE (the Mega 2560 also works, but ADK is the exact setting).
  2. LED inserted backwards: it only lights up in the direction pin → anode, cathode → resistor → GND.
  3. Missing resistor: the LED blinks but degrades quickly; current absorption per pin is limited to 40 mA absolute maximum.
  4. Pin 7 reused in a subsequent circuit: it is internally wired to the MAX3421E RST and breaks USB host communication.
  5. Wrong USB cable: some cables are "charge only" and do not transmit data — the serial port then never appears.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials