Go Down

Topic: (solved) Problem with adafruit motorshield V2 - DC motor not running properly (Read 121 times) previous topic - next topic

DesertPhoenix

I came across the solution to this myself, so this post is just for anyone else who encounters the same problem.


Problem was, while the test-code (DCmotorTest) from the 'adafruit motorshield V2 libary' worked, I couldn't get it to work when adapting it for my own code. Even when the speed was set to 255, one wheel would idle along, barely moving, while the other zipped along.

It initially wouldn't run at all, but I found that by having it run over the 'play motor code every iteration of the loop, it'd go - sort of.
  leftMotor->setSpeed(255);
  leftMotor->run(BACKWARD);
  leftMotor->run(RELEASE);
 

Just for more detail, I have two adafruit motorshield V2's, with a 12V motor running out of each one, in position M1 on both. I also have an external 12V power supply plugged into both shields power terminals.

This was bugging me for about a month. I tried everything I could think of. Resoldering wires, pulling the gearbox apart to make sure the gears wern't stripped, testing the motors... took me till yesterday to figure out what was going on.

SOLUTION
I have no idea why, but for some reason the functionality of 'BRAKE' and 'RELEASE' seem to be reversed. I'm not sure if this is universal, or if my motorshields are damaged in some way, but if I want to start a motor and keep it running, I need a single iteration of the following

  leftMotor->setSpeed(255);
  leftMotor->run(BACKWARD);
  leftMotor->run(BRAKE);

and if I want to stop it, I need it to run

  leftMotor->run(RELEASE);



Hopefully this is of some help to people, and if anyone knows whats going on, don't be afraid to jump in.

Go Up