Start with Arduino Mega 2560

Getting started with the Arduino Mega 2560

This guide shows you how to use your Arduino Mega 2560 and to upload a sketch.

First you must connect your Arduino board to your computer, you need a USB cable (A plug to B plug). The USB cable will provide power and allow you to program the board. 
USB cable 
Attack the B plug of the USB cable to the Arduino Mega and the A plug to the PC. 
Now the green power LED (labelled ON) should turn on.

To upload a sketch, you must use Arduino IDE.
Choose the correct version for your operating system, download and install it.

Open your Arduino IDE, choose Arduino Mega 2560 from the Tools > Board menu in the IDE, and select the correct serial port from the Tools > Serial Port menu. 
Now choose an example from File > Examples menu and upload it, clicking the relative button.

Differences from ATMEGA based boards

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. 
You can find the ATmega2560 datasheet here. It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller. 
In general, you can program and use the Mega as you would do with other Arduino boards.


The Arduino Mega 2560 can be powered via the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the GND and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The Arduino Mega 2560 has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.

Installing Drivers for the Arduino Mega 2560


The first time you plug a MEGA into a Mac, the "Keyboard Setup Assistant" will launch. There's nothing to configure with the MEGA, so you can close this dialogue by clicking the red button in the top left of the window.

Keyboard Setup Assistant


If you previously installed Arduino IDE, you already have drivers installed.

If you haven't yet installed Arduino IDE, download the Windows version of the Arduino software from the official page here
When the download finishes, launch the file to install the software and the drivers.

If you downloaded the .zip version of the IDE, unzip the downloaded file. Make sure to preserve the folder structure. 
Now your drivers will be downloaded and installed from Internet, directly from Windows. 
If you have issues, you can find the "drivers" folder inside the unzipped file, for manual installation.


There is no need to install drivers for Ubuntu 10.0.4

In some computers, you need to setup user permissions and some udev rules. 
You can find detailed informations on how to achieve this at this page.

Uploading Code to the Mega 2560

The uploading process on the Arduino Mega 2560 works the same as other boards from a user's standpoint. 
Here are shown the steps used to upload a sketch:

  • Connect your board to the computer by attaching the USB cable to the USB port.
  • Open the Arduino IDE.
  • In the "Tools" menu choose "Serial Port" and select the serial port of the Mega 2560.
  • Under the "Tools > Boards" menu select "Arduino Mega or Mega 2560".
  • You are now ready to upload sketches to your Arduino Mega 2560.