ELEGOO MEGA · LESSON 2
Blink
Blink the Mega’s onboard L LED once per second.
Configure a digital output and set its timing with delay().
Parts List
- ELEGOO Mega 2560 R3 is a 5 V ATmega2560 AVR board with many I/O pins and four hardware UARTs for control systems with several peripherals. Long ELEGOO-branded Mega PCB with USB-B and barrel connector, ATmega2560 marking, extended side headers and a large double-row digital header at the end. Read printed Mega labels; its SPI hardware placement is not the same numeric pins as an Uno.
- A USB-A to USB-B cable carries USB power and, when its data conductors are present, a host/device data link. USB-A plug and square USB-B plug. Inspect the plug shape; micro-USB is not USB-C, and USB-B is the squarer device connector.
Assembly
- Leave the external headers unconnected.
- Connect the Mega with a USB data cable.

Reviewed pin-to-pin connections
| From | To | Purpose / notes |
|---|---|---|
| Mega: USB-B | Host: USB data cable | |
| Mega: LED_BUILTIN / D13 | Onboard LED: L (already fitted) |
Code
PlatformIO configuration
[env:mega]
platform = atmelavr@5.3.0
board = megaatmega2560
framework = arduino
monitor_speed = 9600
// Arduino.h provides Arduino functions such as pinMode(), digitalWrite(), and delay().
#include <Arduino.h>
// setup() runs once after power-on or reset. "void" means this function returns no value.
void setup() {
// The board already has an LED. OUTPUT lets this pin drive that LED.
pinMode(LED_BUILTIN, OUTPUT);
}
// loop() repeats as long as the board is running.
void loop() {
// HIGH turns the LED on for this board.
digitalWrite(LED_BUILTIN, HIGH);
// delay() waits in milliseconds: 1000 ms is one second.
delay(1000);
// LOW turns the LED off.
digitalWrite(LED_BUILTIN, LOW);
// Then wait another second before loop() starts again.
delay(1000);
}
Expected behavior
The L LED repeats about one second on, one second off. No serial output is expected.
Experiments & Challenges
- Change both 1000 ms delays to 500 ms and compare the period.