Let's Make Robots!

2WD Car Driving in circles


I've just mounted a magician robot, using Dagu's magician chassis and Dagu magician controller. By runing the simple code that follows, it walks in circles, while it should be walking straight in line. I guess one of the motors is being faster than the other. Is this normal?





Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hmm I can`t find the code. And I guess you meant driving instead of walking?

Hi Markamas, Sorry, I forgot. Here is it. Also, I thought about writing driving but I was not sure about this expression since I had never written something driving without a driver before. I was confused! =)


int MLD = 7;

int MLV = 9;

int MRD = 8;

int MRV = 10;

void setup() {                

  pinMode(MLD, OUTPUT); // Left direction

  pinMode(MLV, OUTPUT); // left speed

  pinMode(MRD, OUTPUT); // Right direction

  pinMode(MRV, OUTPUT); // right speed



void loop () {



   digitalWrite(MRD, HIGH);       

   analogWrite(MLV, 200);   //PWM Speed Control

   analogWrite(MRV, 200);   //PWM Speed Control




are the two pins, 9 and 10, meant for PWM output on your controller?

Yes mate, this 2 are the pwm pins!

It is common for them to not move at exactly the same speed.