Even though Krich say that "rather obvious, observation", unfortunately that the ADMIN explanation is not that obvious for me. I believe on what you said about changing for the other proposed numbers and see that it will not work, but I do not understand why.
I got more confused after thinking more and more about the answer that the ADMIN gave.
I am a really beginner so bare with me on the following questions.
a) looking at the following code
void servo_left(signed long int speed)
{
PORT_ON(PORTD, 0);
delay_cycles(speed);
PORT_OFF(PORTD, 0);//keep off
delay_cycles(200);
}
void servo_right(signed long int speed)
{
PORT_ON(PORTD, 1);
delay_cycles(speed);
PORT_OFF(PORTD, 1);//keep off
delay_cycles(200);
}
it seems that the motors always go forward, i.e. it does not matter the value of the input argument SPEED. The speed input just make the motor ON for some milliseconds, just that. If the motors are in reverse order, then from item (a) this robot should only spin around and go nowhere...
So, the question is: what is wrong in my code analysis?
b) I have never played with servos, so, the second question that I have is: can I change the velocity of this motor? Can I reverse it? Can I change the PIC output value so that the motor can go faster? (if possible, how?).
More questions will come for sure, but these are my first two...
Thanks for your attention.
Paulo Brasko