Go Down

Topic: SERVO HACKING FOR CONTINUOUS ROTATION PROGRAM CODE (Read 3 times) previous topic - next topic

Jnixetra

so u means i must use the servo.write() to determine the angle?

hellonearthis

So you have read http://www.arduino.cc/en/Reference/Servo and looked at this http://arduino.cc/en/Tutorial/Sweep

I'm guessing if you set pos to a positive number it will spin forward
ie
Code: [Select]

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

Grumpy_Mike

Quote
so u means i must use the servo.write() to determine the angle?

Yes.

Jnixetra

Ok i gt it edi...

Really thank you for both of you... Appreciate it very much :)

kf2qd


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.

Go Up