Getting Started with Arduino MEGA2560

The Arduino MEGA 2560 is designed for projects that require more I/O lines, more sketch memory and more RAM. With 54 digital I/O pins, 16 analog inputs and a larger space for your sketch it is the recommended board for 3D printers and robotics projects. This gives your projects plenty of room and opportunities maintaining the simplicity and effectiveness of the Arduino platform. This document explains how to connect your Mega2560 board to the computer and upload your first sketch.

The Arduino Mega 2560 is programmed using the Arduino Software (IDE), our Integrated Development Environment common to all our boards and running both online and offline. For more information on how to get started with the Arduino Software visit the Getting Started page.

Use your Arduino Mega 2560 on the Arduino Web IDE

All Arduino boards, including this one, work out-of-the-box on the Arduino Web Editor, you only need to install Arduino Create Agent to get started.

The Arduino Web Editor is hosted online, therefore it will always be up-to-date with the latest features and support for all boards. Follow this simple guide to start coding on the browser and upload your sketches onto your board.

Use your Arduino Mega 2560 on the Arduino Desktop IDE

If you want to program your Arduino Mega 2560 while offline you need to install the Arduino Desktop IDE

Connect your board

Connect your Mega2560 board with an A B USB cable; sometimes this cable is called a USB printer cable

A000067 iso both USBCable

The USB connection with the PC is necessary to program the board and not just to power it up. The Mega2560 automatically draw power from either the USB or an external power supply. Connect the board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

Open your first sketch

Open the LED blink example sketch: File > Examples >01.Basics > Blink.

UNO Load Blink

Select your board type and port

You'll need to select the entry in the Tools > Board menu that corresponds to your Arduino board. You have a Mega2560, therefore it has an ATmega2560 microcontroller, selected by default as processor.

MEGA BoardType

Select the serial device of the board from the Tools | Serial Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

MEGA Port

Upload the program

Now, simply click the "Upload" button in the environment. Wait a few seconds - you should see the RX and TX leds on the board flashing. If the upload is successful, the message "Done uploading." will appear in the status bar.

UNO Upload

A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board start to blink (in orange). If it does, congratulations! Your board is up-and-running. If you have problems, please see the troubleshooting suggestions.

Tutorials

Now that you have set up and programmed your Uno board, you may find inspiration in our Project Hub tutorial platform

or have a look to the tutorial pages that explain how to use the various features of your board.

The text of the Arduino getting started guide is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the guide are released into the public domain.