I didn't see anything about this here, my apologies if I missed it.
I'm trying to use a couple Parallax continuous rotation servos to drive the wheels on a new robot I'm putting together. I apparently don't understand pwm because I can't get anything out of them but a slow chugging. I've got a six volt battery pack that I just checked and is putting out 6.5 volts, so I don't think it's a lack of power. The output from the battery goes through an LM2940CT so the system sees a regulated 5V (which I've measured to be 5V).
I'm using avr-gcc, and an ATtiny84 because it's small and has a 16 bit timer. The internal oscillator runs at 8MHz, which I'm dividing by 8. I tried using the code from one of the tutorials here, and have been monkeying around with it to no avail. If anyone can see what I'm doing wrong I'd appreciate a clue. Here's the code I'm using now.
/*
* for ATtiny 84.
*
*/
#define F_CPU 1000000
#include <avr/io.h>
#include <util/delay.h>
void initPWM()
{
TCCR1A = 0;
ICR1 = 19999;
DDRA = _BV(DDA6) | _BV(DDA5);
TCCR1A = (1 << WGM11);
TCCR1B = (1 << WGM13) | (1<<WGM12) | (1 << CS11);
TCCR1A |= (1 << COM1A1) | (1 << COM1B1);
}
int main()
{
initPWM();
OCR1A = 500;
OCR1B = 1000;
_delay_ms(1000);
OCR1A = 750;
OCR1B = 1000;
_delay_ms(1000);
OCR1A = 800;
OCR1B = 1000;
_delay_ms(1000);
for(;;)
{
}
}
Thanks
Joe