Timer setup VNH5019 library on Arduino Mega different pins

Hi . I need help to find out how to use the Library when i am changing pins on the Arduino Mega. I am going to use Three VNH 5019 Shields Connected to one Arduino Mega.Then i would like to set up timer Three and four to drive these Boards on pin2,3,5 and 6,7,8. I am a beginner and this is little above my head , i have searched det internet for answers but i have not find any god answers. I am an Norwegian so the Language do not help me neither :wink:
If someone could bee so Nice to help me out i would be greatful.

Attaching .h and cpp file which i hope only needs to be customized by setting the timers. somebody who dar to try ?
DualVNH5019MotorShieldMegaSeveralCards.cpp (12.8 KB)
DualVNH5019MotorShieldMegaSeveralCards.h (3.5 KB)

Her is a PDF of the setup.It is planned to be used in a ROV for driving the thrusters.
BOTTLE 1 SUBSEA1.pdf (224 KB)


Your plan to use those pins and timers seem reasonable. However, since you are new to this, I recommend starting simple. You might try directly calling the analogWrite() function to send the appropriate PWM signals to the driver before writing your own library. I also suggest getting the motor shields working one at a time before combining them in your system.

- Jeremy

Hi Jeremy
Thanks for the reply.
I did not mention that i have tried the Library without modify it , and this was working well for a simple setup. But the Next thing is to setup timer 4 and 5. I can not find any good explanation on the web for correct setting of them . all tutorials is on timer1 or timer 0 . Since atmega4560 has different settings in registrer than ex uno , are they not so relevant for my purpose.
I Guess there is some other out there who needs the same explanation ?

So to be Clear : what setting should be done for setting up timer 4 to fast PWM on 6,7,8 and what setting should be done for setting up timer 5 to fast PWM on 44 ,45,46


Hello, Alvin.

The registers for all of the timers on the Arduino Mega are defined in the ATmega2560 datasheet. You might try looking at how timer0 and timer1 are set up in the tutorials you mentioned and using that as an example of how to set up timer4 and timer5.