Page 1 of 1

Stacking 2 Motor Driver

PostPosted: Tue Oct 18, 2016 2:48 pm
by azahid2
Hi,

I'm currently working on a personal project, 3 wheel drive robot. Which require me to control each motor independently. Since Cytron 2A Motor Driver Shield is only capable of handling 2 motors, can I stack this 2 shields together to control 3 motors?
If yes, how would I implement it in arduino code?

Current setup:
1. Cytron ARM Cortex M0
2. Cytron 2A Motor Driver Shield (2 unit)
3. PS2 Shield

Can the code be like this?

CODE: SELECT_ALL_CODE
#include <Shield2AMotor.h>
#include <SoftwareSerial.h>
#include <Cytron_PS2Shield.h>

Cytron_PS2Shield ps2(2, 3); // SoftwareSerial: Rx and Tx pin
//Cytron_PS2Shield ps2; // HardwareSerial, note:
//Pin declaration

int mtr1 = 5; //PWM /////////FIRST MOTOR SHIELD/////
int mtr2 = 6; //PWM /////////FIRST MOTOR SHIELD/////
int mtr3 = 11; //PWM ////////SECOND MOTOR SHIELD///
int RightDir = 4;
int LeftDir = 7;

void setup()
{
  ps2.begin(9600); // This baudrate must same with the jumper setting at PS2 shield
  ps2.reset(1); //call to reset ps2 shield
  delay(100);
  ps2.reset(0);
  pinMode(m1,OUTPUT);
  pinMode(m2,OUTPUT);
  pinMode(m3,OUTPUT);
  pinMode(RightDir,OUTPUT);
  pinMode(LeftDir,OUTPUT);
  Serial.begin(9600); // Set monitor baudrate to 9600
 
}

Re: Stacking 2 Motor Driver

PostPosted: Wed Oct 19, 2016 10:25 am
by Idris
Hi azahid2,

Before we verify your code, could you share a few clear photos of your hardware setup?

Thanks.