Author Topic: Servos Stuck at full Left (w/ unmodified $50 board)  (Read 1635 times)

0 Members and 1 Guest are viewing this topic.

Offline ksquaredTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
Servos Stuck at full Left (w/ unmodified $50 board)
« 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:
Code: [Select]
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!
« Last Edit: March 18, 2010, 09:18:04 AM by ksquared »

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Re: Servos Stuck at full Left
« Reply #1 on: March 16, 2010, 05:10:50 PM »
What is the delay() method? The $50 robot uses delay_cycles()

Offline ksquaredTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
Re: Servos Stuck at full Left
« Reply #2 on: March 16, 2010, 08:58:47 PM »
Ooops.  I was writing that code from memory. haha.

Yes, that would be delay_cycles().

Gracias. 

 


Get Your Ad Here