thanks to all,
i have servo motor model ( SM-s8166B ) with power 6 volt .. 20kg torque.
i need a code to make a project with 4 switches ( sw1 - sw2 - sw3 - sw4 )
when i make sw1 ON the servo rotate to 45 degree
when i make sw1 OFF the servo back to 0 degree
when i make sw2 ON the servo rotate to 135 degree
when i make sw2 OFF the servo back to 0 degree
when i make sw3 ON the servo rotate to 225 degree
when i make sw3 OFF the servo back to 0 degree
when i make sw4 ON the servo rotate to 315 degree
when i make sw4 OFF the servo back to 0 degree
i tried it before but when i connect the power servo rotate continuously without stopping and Without consideration the code
when i make sw1 ON the servo rotate to 45 degree
when i make sw1 OFF the servo back to 0 degree
when i make sw1 ON the servo rotate to 135 degree
when i make sw1 OFF the servo back to 0 degree
when i make sw1 ON the servo rotate to 225 degree
when i make sw1 OFF the servo back to 0 degree
when i make sw1 ON the servo rotate to 315 degree
when i make sw1 OFF the servo back to 0 degree
After copy/paste did you forget to change the switch numbers ?
What if 2 switches are on at the same time ?
What code have you tried ?
Robin2
February 18, 2020, 8:31am
3
waleedelsabahy:
i tried it before but when i connect the power servo rotate continuously without stopping and Without consideration the code
That sounds as if you have a continuous rotation servo. They are not capable of moving to a specific angle. You can just control the speed and direction.
...R
Robin2
February 18, 2020, 1:57pm
6
waleedelsabahy:
sorry, i changed it
Changed what?
If you mean that you are now using a different servo it would be very useful to know what happens when you try it.
And also you need to post your program.
...R