I believe this is not a new topic but recently i just came across to hack my servo so it can continuously turn 360 degree in clockwise and anticlockwise..
After i hack my servo, i would like to write a program so it can turn in clockwise and anticlockwise when received signal from my transmitter. What i want is exactly from this video: Hacked Servo - YouTube
Hope anyone whoever try this before can help me with the program!!! I really need it very very much!!! Thank you!!!
So you have hacked the servo by Taking out the pot and replacing it with a couple of resistors (and a trimpot to balance the two).
Coding would seem simple, setting the servo position a value of plus degrees moves it forward (the more degrees the faster I guess) and to stop to set the position back to zero.
Reversing would me setting negative values.
It is now a continuous rotation so it doesn't matter what degrees it is.
You don't appear to be giving any servo control commands in that code.
You need to find what angle corresponds to off. Then just set the motor for an angle greater than this for clockwise or less than this for anti clockwise. The larger the difference between zero angle and the angle you give will determine the speed.
I'm guessing if you set pos to a positive number it will spin forward
ie
pos=45;
myservo.write(pos); // start forward movement
delay(2000); // wait a couple of seconds
pos=0;
myservo.write(pos); // stop forward movement I think?
delay(2000); // wait a couple of seconds
Jnixetra:
so u means i must use the servo.write() to determine the angle?
No - servo.write is going to be more of a speed control (within limits). You removed the position feedback inside the servo to make it a continuous rotation. Ideally your dead spot should be at 90 and numbers less than 90 will rotate in one direction and numbers greater than 90 will rotate in the other direction. You could write some code that starts at 0 and goes to 180 and then back to 0 with a pause at each setting, write the current output value to the serial and then you can see where the servo starts and stops each direction and use an nuber in the mddle of where it stops from each direction as you zero speed number.