# servo motor and switchpin

Hi! I'm making my first program and I need your help. I want to control 2 continuous rotation servo motor with 2 switch. First, can I stop those motor? I'm trying everything to make them stop and it's not working.

Can someone help me with the code!? For exemple, if I press the switch #1, the motor 2 will make a complete rotation. If I press the switch 2, only the second motor will works.

Thanks for you help!

You can stop them, but not at a certain position if that's what you mean. So to make it do a complete rotation and stop back at the position it started at, is not possible without some more stuff like an encoder.

Basically once a servo is a continuous servo, it stops being a servo: you sacrifice position control for direction and speed control.

Audep1: Hi! I'm making my first program and I need your help. I want to control 2 continuous rotation servo motor with 2 switch. First, can I stop those motor? I'm trying everything to make them stop and it's not working.

Can someone help me with the code!? For exemple, if I press the switch #1, the motor 2 will make a complete rotation. If I press the switch 2, only the second motor will works.

Thanks for you help!

As JimboZA says, you can't make a continuous-rotation servo do exactly one turn.

To stop a continuous-rotation servo, using the "Servo" library, you write a 90 to it. e.g.

``````servo.write(90);
``````

OldSteve: To stop a continuous-rotation servo, using the "Servo" library, you write a 90 to it.

In theory.... Although I've never used one, apparently the exact stopping value can be somewhere between say 88 and 92. I believe some such servos have an adjusting screw so you can make it stop at exactly 90.

JimboZA:
In theory… Although I’ve never used one, apparently the exact stopping value can be somewhere between say 88 and 92.

Yep, you’re spot on. I was just thinking that I should maybe add that info. Thanks for saving me the trouble.

I believe some such servos have an adjusting screw so you can make it stop at exactly 90.

Right again. (Two of the servos sitting here now have trim screws, and two don’t.)