Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

Arduino Leonardo

Interactive Arduino Leonardo pinout showing I2C on D2/D3, SPI on the ICSP header, 12 analog inputs and native USB serial, with upload fixes and a compile-checked blink.

5 V logic

Community draft — report a mistake

MCUATmega32U4, 16 MHz, 8-bit AVR with native USB
Flash / SRAM32 KB (4 KB bootloader) / 2.5 KB
EEPROM1 KB
I/O20 digital (7 PWM), 12 analog in (A0–A5 + 6 on digital pins)
USBMicro-USB, handled by the chip itself — can act as a keyboard or mouse
Typical price₹450–700 (clone, indicative)

The Leonardo looks like an Uno, but it runs on an ATmega32U4, which handles USB itself. That one change explains every difference: the board can appear on a PC as a keyboard, mouse or game controller, Serial is a native USB port, and D0/D1 are free.

Pick the Leonardo for USB projects: macro pads, shortcut keyboards, presentation clickers, custom game controllers. Stay with the Uno for most shields and beginner tutorials: the I2C and SPI pins sit in different places on the Leonardo, so Uno wiring diagrams don’t always transfer. Same idea in a smaller board: the Pro Micro uses the same chip.

The pinout lists the power and analog header on the left and the digital header on the right, as on the Uno. The three SPI pins come last, because they are on the ICSP header. The extra analog inputs A6–A11 live on D4, D6, D8, D9, D10 and D12.

Power it from USB, 5 V on the 5V pin, or 7–12 V on VIN or the barrel jack. Logic is 5 V; 3.3 V modules need level shifting on their inputs.

Interactive pinout

Hover or tap a pin for its functions and traps. Filter to light up every I2C, ADC or boot pin.

  • Safe for most uses
  • Works, with a caveat
  • Avoid unless you know why
  • Power / control

I2C is on D2/D3, not A4/A5. Wire SDA to D2 (or the SDA pin by AREF) and SCL to D3 (or SCL). Uno wiring that uses A4/A5 for I2C does not work on the Leonardo.

SPI is only on the ICSP header. D11–D13 are not SPI here. RC522, SD-card and TFT modules connect to MISO, SCK and MOSI on the 2×3 ICSP header.

Keyboard/Mouse sketches can lock you out. A sketch that types or moves the mouse non-stop makes the PC hard to use. Start HID output only when a button is pressed, and keep the reset trick (below) in mind.

D0/D1 are free for modules. USB serial is built into the chip, so D0/D1 are a spare hardware UART (Serial1) for GPS, GSM or Bluetooth modules — no SoftwareSerial needed.

Set up your computer

  1. Install Arduino IDE 2.x from arduino.cc.
  2. Boards Manager → install Arduino AVR Boards (we compile against avr 1.8.8).
  3. Tools → Board → Arduino Leonardo, then pick the port that appears when you plug the board in.

First program

Verified — core avr 1.8.8, 3 Nov 2026Compile-only
blink-arduino-leonardo.inoArduino C++Open in PlaygroundOpen in Playground
// First program for the Arduino Leonardo: blink the "L" LED on pin 13 and print to Serial.
// The ATmega32U4 does USB itself, so Serial is a native USB port: it disappears for a moment at
// every reset/upload. We wait up to 3 s for the Serial Monitor — never `while (!Serial);` on its
// own, or the board hangs when it runs from a charger with no PC attached.
uint32_t count = 0;

void setup() {
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  uint32_t t0 = millis();
  while (!Serial && millis() - t0 < 3000) {}
  Serial.println(F("FlashReady: Leonardo blink"));
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
  Serial.print(F("blink "));
  Serial.println(++count);
}

Components with Arduino Leonardo

Common errors

Couldn't find a Board on the selected port / port disappears during upload

The Leonardo resets into its bootloader under a new COM port for 8 seconds. If the IDE misses it, press RESET as soon as “Uploading…” appears (a quick double-press keeps the bootloader running).

Serial Monitor misses the first lines

The USB port restarts with the sketch. Wait for it: while (!Serial && millis() < 3000) {} — never a bare while (!Serial);, which hangs on a phone charger.

I2C scanner finds nothing (module on A4/A5)

Move SDA to D2 and SCL to D3. A4/A5 are plain analog pins on the Leonardo.

RC522 / SD card does not respond on D11–D13

Use the ICSP header for MISO, SCK and MOSI. CS/SS and RST can go on any digital pin, e.g. D10 and D9.

↑↓ to move · Enter to open