Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
#include<stdio.h>#include<avr/io.h> //for 8mhz internal oscillator controlling servo by centering it #include<avr/interrupt.h> #include<util/delay.h>int main (void) { unsigned int i; DDRD |= _BV(5); // Set PORTD5 as output DDRC =0x01; TCCR1B |= (1 << WGM13); // phase and frequency correct mode ICR1=10000; TCCR1A|=(1<<COM1A1);//clear oc1a when upcounting and set Oc1a while downcounting TCCR1B |=(1<<CS11); // Start timer at Fcpu/8 PORTC=0X01; while(1) { for(OCR1A=350;OCR1A<1150;OCR1A++) { _delay_ms(1); } for(i=1;i<=50;i++) { _delay_ms(10); } for(OCR1A=1150;OCR1A>350;OCR1A--) { _delay_ms(1); } for(i=1;i<=50;i++) { _delay_ms(10); } }return(0); }