Also I "hacked" the servos so that they can rotate endlessly................The pulses are supposed to make the servo rotate 90 degrees in either direction depending on what button you press.
I know how to make the servo move to a specific angle,
Hi old Steve,i have a very similar project but i have 4 servos which i made continuous rotation and five switches one for every servo and one more for all together.i will be adding more servos and switches in the future .But for now i need to figure out the code for what i got now.any help i can geti think would help both LinusRJ and me.would be appreciated.
they are very similar issues
What you said about servo.write(180) and servo.write(0) where they will just keep on spinning. Would it be possible to write for example servo.write(180, how many ms you want it to turn?)Then I might have the solution for my project.
OldSteve, thanks for the help. I might need to buy some sail winch servos then.A question that I did not get an answer to yet is, can you send pulses to servos?Each time you press the button, the servo will rotate 90 degrees from its' previous position. My idea is something like; servo.write(+90); or servo.write(-90) to make it spin 90 degrees either direction.
byte currentPos = 120; // This would be the last position that you wrote to the servo.servo.write(currentPos); // Like so....servo.write(currentPos-90); // This will position the servo relative to the last known position.
OldSteve, so if I were to buy a sail winch servo and wire it up to a button. Would it be possible to do what I asked for above? How would the code look?
Even with standard servos it's not possible to have the library handle that. You'd need to do the calculation in your firmware, based on the last position you wrote to the servo.
void write(int value); // if value is < 200 its treated as an angle, otherwise as pulse width in microseconds void writeMicroseconds(int value); // Write pulse width in microseconds