Converting Project From Ard'o Uno -> Mega

Hello,

I am looking to perform Project 5 from J. Boxall's Arduino Workshop, which uses the Arduino Uno, on my Arduino Mega 2560.

From what I read, the code is fundamentally the same; the only thing that changes are the pin numbers.

The code may be found here - http://pastebin.com/z0W1vwvG

My main concern about adapting the project concerns pins 0 and 1 of the Arudino Uno. According to Arduino Workshop, "[p]ins 0 and 1 are also known as the serial port, which is used to send and receive data to other devices, such as a computer via the USB connector circuitry."

On the Mega, the ports marked 0 and 1 (TX0 and RX0) are not marked "digital", thus my concern.

My question is - will any old digital port on the Mega do (ports 22-53) in lieu of ports 0-13 on the Uno, or are ports 0 and 1 used for a reason?

Thanks for your help.

My question is - will any old digital port on the Mega do (ports 22-53) in lieu of ports 0-13 on the Uno, or are ports 0 and 1 used for a reason?

The UNO does not have 13 ports. The Mega does not have 53 ports. A port is a collection of pins. The Uno has 14 digital pins. The Mega has 54 digital pins. The first 14 digital pins on each board are the same. So, if the sketch works on the Uno, it will work UNCHANGED on the Mega.

1 Like

Thank you for the clarification.