I recently purchased the Adafruit Motorshield. It can flawlessly run either motors or servos, but if I try to run the motors (any of the 4 channels) the servos go beserk. Here is my test code: #include <AFMotor.h>
AF_DCMotor motor(4);
Hmmm, looks like it ought to work having looked a bit at the library. Probably crosstalk or missing ground connection? Is the power supply powerful enough to run servos and motors?
I tried hooking the servo directly up to pin 13 (which isn't used by the shield), gnd and 5V, and the motor to M4, running off of the seperate power brick, and the servo still had irregular motion. If I wanted to control the Adafruit shield without the AFMotor.h library, I could just use analogWrite for PWM and digitalWrite for direction, right?
You'd have to drive the pins that talk to the shift register with digitalWrite and the 4 PWM pins it uses with analogWrite, yes. And remember to set them as OUTPUTs.