Society of Robots - Robot Forum
Software => Software => Topic started by: ksquared on March 16, 2010, 04:39:15 PM
-
I was trying to work with unmodified servos. My code will be a little weird; I am using the $50 robot, and for ease, I simply put the servo control output on pin4, just like the LED. My test code went something like this:
while (1) {
LED_on();
delay_cycles(35);
LED_off();
delay_cycles(200);
}
I read on the spec of the servos, recognized delay pulses range from .9ms,1.5ms(middle) and 2.1 ms. NO matter what I put in for 35, though, it goes extreme left. I even used a stripped servo to adjust the pot manually and it still kept going. Could the whole dang thing "cycles = (23/.992)*(milliseconds)" be using wrong constants (23 and .992) because I am using atmega168 rather than atmega8, (which I presume runs at a different speed?) If so, how do I recalculate those values? Failing that, there is always timers...
Thanks!
-
What is the delay() method? The $50 robot uses delay_cycles()
-
Ooops. I was writing that code from memory. haha.
Yes, that would be delay_cycles().
Gracias.