When I read about mega2560 I saw it has 54 digital that can be used as input or output.
later on I saw the some of them are used for things like communication.

So I would like to know if the communication pin can still be used as output ? (to power leds)

2 Answers 2


Yes. Any pin can be used as a digital input/output. However, you cannot use certain communications when using those pins.

The types of communication and their effects on the pins:

  • SPI: This protocol is used for certain communications with certain breakout boards and shields. For example, the ethernet shield uses SPI to connect. On the Mega(2560), it is pins 50-53.
  • I2C: This protocol is also for connecting to external items. It is much slower than SPI, but uses only two pins. On the Mega, it uses pins 20/21.
  • UART/Serial: UART is a communication method that uses two wires and transmits bytes of data. It is often used to connect to things that don't need extreme amounts of data passed, but need a stable two way connection.
    • On all standard boards, the main UART is on pins 0 and 1. This is usually connected to a UART to USB chip which is sent to the computer. Note: you should still be able to upload sketches if they act as an output and random on/off won't hurt the device.
    • The Mega(2560) also has UART on pins 14/15, 16/17, and 18/19.

Yes, you can.

You are referring to SPI, I2C, and the 4 serial interfaces. If you want to use those you have to use the predefined pins for that. If you are not using those you can use them as normal GPIO.

If you want Serial communication for debugging, you shouldn't use digital pins 0 and 1.

If you need even more pins, you can even use the analog pins and digital input/output pins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.