First time poster so please be gentle...
I'm a software designer just getting into the arduino scene for fun with a little side project in mind.
At any rate, I have an Uno and various components, but the one thing that's confusing me at the moment is the control of a servo. I've done the obvious and uploaded the example sweep sketch and that works fine, however when I then want to write to a particular angle, rather than sweep, I get no noticeable response out of the servo. Something IS happening as I can hear a pulsing from the servo itself
As mentioned, if I just take the default sweep sketch and run it, it sweeps through the degrees no problem. If I then take that same sketch and just change the write lines from .
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
to
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(10); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(170); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
I would expect that it should write to first 10 degrees, then to 170 degrees. Yes, I realize that's not the best approach, I'm just trying to minimize the differences between what works and what doesn't. If I create a simple sketch that just writes various angles and delays in between again I get nothing.
The only thing I've been able to find is the caution against providing a proper ground, and I do have that (proof is that the sweep example works). Other examples, I've seen just write the angle to the servo and it (apparently) just works.
The only other thing I can think of is that it depends on the servo itself. I'm using a MS24 20kg Miuzei Digital Servo (Google that on Amazon and you'll see it).
Any thoughts/suggestions? Or am I missing some basic understanding on how the servo control works?
Thanks.