Stacking 2 Motor Driver

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

Stacking 2 Motor Driver

Postby azahid2 » Tue Oct 18, 2016 2:48 pm

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
#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
 
}
azahid2
Fledgling
 
Posts: 1
Joined: Tue Oct 18, 2016 2:41 pm

Re: Stacking 2 Motor Driver

Postby Idris » Wed Oct 19, 2016 10:25 am

Hi azahid2,

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

Thanks.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 366
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 4 guests

cron