I have been trying to get a mini servo to work the same time I try to run the motors. If I run my program with just the servo OR motors alone eather will run ok BUT not at the same time…(servo on pin 5)
OK, Is there anyone who is using a servo of any kind with the zumo shield. I want to use the
ping)) on the mini servo on top of my zumo and have not been able to program the motors to
work with the servo working at the same time. (WHY ?)
Make sure nothing else is using the same pin as the servo.
Make sure there is enough power to drive both motors and servo. This is very possibly your problem, although you only say “it doesn’t work,” you don’t say what the actual symptoms are. Make sure you draw servo power from the battery, not from the +5V or regulator output.
There may be other issues, like maybe the motors and the servo control you’re using are using the same timer, in which case it won’t work right. Try generating a suitable servo pulse every 30 milliseconds by doing “digitalWrite(5, HIGH); delayMicroseconds(1500); digitalWrite(5, LOW);” to center the servo. If that still doesn’t work, it’s most likely the power that’s the problem.
Hello. You might want to check out this project which also uses a Zumo, servo, and a PING))) sensor. I am not sure if he actually got the servo to move though:
Wrote program w/o zumo.h and servo.h and both motors,ping and servo works ok.
The problem for me must have been timmers or interupts in the .h, now to let my zumo
rome around (changed name from zumo to WALL E jr).
Has anyone got this working? I have spent a couple hours troubleshooting a problem using a servo. I was proud of myself (a noob) for isolating the fact that it was the servo causing the issue but I haven’t been able to get around it. If I comment out servo.attach(4) the motors run at the right speed otherwise they don’t respond to changes and I can’t control the servo. I am running off of board 5v power.
The ZumoMotors library uses the same timer as the Arduino Servo library (Timer 1), so the two libraries conflict. We recently wrote some code to work around the issue; you can find that code in this thread.
[quote=“DavidEGrayson”]Hello. You might want to check out this project which also uses a Zumo, servo, and a PING))) sensor. I am not sure if he actually got the servo to move though:
This version of Fuzzbot does not use the servo.
I checked the source code.