#define F_CPU 16000000UL #include #include int main(void) { DDRB |= (1 << PB1); TCCR1A = (1 << COM1A1) | (1 << WGM11); TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS11) | (1 << CS10); ICR1 = 4999; while (1) { for (uint16_t pos = 250; pos <= 500; pos++) { OCR1A = pos; _delay_ms(8); } for (uint16_t pos = 500; pos >= 250; pos--) { OCR1A = pos; _delay_ms(8); } } }