Arnoldo B. Canales
Arduino Mega 2560 Microcontroller
Please visit the Arduino Board Mega official website.
Input and Output
The Arduino 2560 Mega has 54 digital pins and all of them can be used as input/output by using functions pinMode(), digitalWrite(), and digitalRead(). They operate at 5 volts @ 40ma and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms.
Some pins have specialized functions:
|Serial 0:||0 (RX) and 1 (TX)|
|Serial 1:||19 (RX) and 18 (TX)|
|Serial 2:||17 (RX) and 16 (TX)|
|Serial 3:||15 (RX) and 14 (TX)|
Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip.
These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See function attachInterrupt() for more details.
Pulse Width Modulation or PWM:
2 to 13 and 44 to 46
Provide 8-bit PWM output using function analogWrite().
Serial Peripheral Interface or SPI:
|50||MISO (Master In Slave Out) - The Slave line for sending data to the master.|
|51||MOSI (Master Out Slave In) - The Master line for sending data to the peripherals.|
|52||SCK (Serial Clock) - The clock pulses which synchronize data transmission generated by the master.|
|53||SS (Slave Select) - the pin on each device that the master can use to enable and disable specific devices.|
These pins support SPI communication using the SPI library. When a device's Slave Select pin is low, it communicates with the master. When it's high, it ignores the master. This allows you to have multiple SPI devices sharing the same MISO, MOSI, and CLK lines. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.
Built-in LED connected to digital pin 13. When the pin has HIGH value (1), the LED is on, when the pin gets LOW (0), the led is off.
Two-Wire Interface or TWI:
20 - SDA - Data Line
21 - SCL - Clock Line
Support TWI communication using the Wire library. Note that these pins are not in the same location as the TWI pins on the Duemilanove or Diecimila. The Mega2560 has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analogReference() function.
Reference Voltage for the analog inputs. Used with analogReference().
When LOW the microcontroller gets a cold Reset.