I am new at this forum and I want to make a simulation of 2 servos on a atmega328. The servos have a period of 20ms and the pulse is between 1-2ms.
I wrote the following code :
//internal clock 1Mhz in the settings
DDRB |= 0xFF;
TCCR1A |= 1<<WGM11 | 1<<COM1A1 | 1<<COM1A0 1<<COM1B1 | 1<<COM1B0;
TCCR1B |= 1<<WGM13 | 1<<WGM12 | 1<<CS10; //Prescaler=1,inverted, fast PWM,Mode 14
ICR1 = 19999;
OCR1A = ICR1 - i;
OCR1B = ICR1 - i;
I would be really grateful to any help or comment.
Last edited by arcachofo on Fri Dec 24, 2021 2:46 am; edited 1 time in total (Reason for editing : Marked as solved (green color))