3.d. Programming Your Arduino

Our Arduino library for the dual VNH5019 motor driver shield makes it easy to get started writing your Arduino sketches. A link to download the library, installation instructions, and the library command reference can be found on the library’s github page. Once installed, we recommend you try out the example sketch by selecting

File > Examples > DualVNH5019MotorShield > Demo

from the Arduino IDE, or by copying the following code into a new sketch:

This example ramps motor 1 speed from zero to max speed forward, to max speed reverse, and back to zero again over a period of about 3 seconds, while checking for motor faults and periodically printing the motor current to the serial monitor. It then performs the same process on motor 2 before repeating all over again.

Note: Even if you don’t have any motors yet, you can still try out this sketch and use the motor indicator LEDs for feedback that the shield is working properly.