This tutorial shows you how to 'port' code and setup from the Arduino UNO R3 to the Arduino MEGA R3.
More...
This tutorial shows you how to 'port' code and setup from the Arduino UNO R3 to the Arduino MEGA R3.
Precondition
Layout of UNO R3 and MEGA R3:
Software
If you haven't changed any Pin-configuration there is no need to change anything with the code! :D
Consider this:
use D22-D53 [D49] before using the additional pins [D100...]
every Pin from D2 to D13 is capable of PWM!
it is possible to change the prescaler and therefore raise the PWM value for PIN_MOTOR_SPE to the recommended 31 kHz [this shouldn't be done on UNO!!!!]
If you use the default D5 pin the upgrade would work like this: