Programming with two Pololu Dual G2 High Power Motor Drivers 24v14 Shields for Arduino

Please show me a program example when using two of these shields.

Hello.

We do not have a specific example program for controlling two dual G2 high-power motor driver shields, but our Arduino library for them can support that if you use the alternate constructor for at least one of your shields. Please see the “Library Reference” section of the README.md file for more information.

Also, keep in mind that you will need to remap the connections for at least one of your shields. The “Remapping the Arduino connections” section of the user’s guide (available on the product page under the “Resources” tab) has more information about that.

If you have trouble getting a program working for this, you are welcome to post the simplest complete version of the code you are testing and I can take a look.

- Patrick

Thank you for your response.
I didn’t know how to remap using the library, so I asked the question, but it worked without problems.
Below is an example of remapping when two Dual G2 High-Power Motor Driver Shields24v14 are connected to Arduino MEGA 2560.
1st unit controls M1 and M2
2nd unit controls M3 and M4

#include "DualG2HighPowerMotorShield.h"

#define M3_SLP 16
#define M3_DIR 13
#define M3_PWM 11     // PWM compatible pin
#define M3_FLT 14
#define M3_CS A2        // M3 Current Sense
#define M4_SLP 17
#define M4_DIR 3
#define M4_PWM 5      // PWM compatible pin
#define M4_FLT 15
#define M4_CS A3        // M4 Current Sense


Dual G2 High Power Motor Shield24v14 md1;
DualG2HighPowerMotorShield24v14 md2( M3_SLP,M3_DIR,M3_PWM,M3_FLT,M3_CS,M4_SLP,M4_DIR,M4_PWM,M4_FLT,M4_CS);

The first is the default pinout.
The second one is as above, but the operation of the PWM signal became unstable unless it was a PWM compatible pin.

I hope it will be helpful for other people.
Thank you very much.

I am glad to hear that you were able to work it out! Thanks for letting us know and for sharing your solution.

- Patrick