const uint8_t pinRC1 = 9; //OC1A output
const uint8_t pinRC2 = 10; //OC1B output
void setup()
{
TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM11); //COM1x clear on match, set on bottom
TCCR1B = _BV(WGM13) | _BV(WGM12)| _BV(CS11); //WGM=14, /8 prescaler
ICR1 = 39999; //20mS period for timer 1
OCR1A = 3000; //1.5mS pulse on pin 9 for centre position
OCR1B = 3000; //1.5mS pulse on pin 10 for centre position
pinMode( pinRC1, OUTPUT );
pinMode( pinRC2, OUTPUT );
}//setup
void loop()
{
int pot1 = analogRead(A0);
int pot2 = analogRead(A1);
// Default servo signal:
// minimal 544 microseconds OCR1 compare value = 1088
// maximum 2400 microseconds OCR1 compare value = 4800
int servo1ocr = map( pot1, 0, 1023, 1088, 4800);
int servo2ocr = map( pot2, 0, 1023, 1088, 4800);
OCR1A = servo1ocr;
OCR1B = servo2ocr;
delay( 20);
}//loop