Arduino pwm LED
починил мерцание светодиодной ленты увеличив частоту ШИМ-а в 64 раза, для этого меняю первый и нулевой таймер так
TCCR1B |= 1<<CS10;
TCCR1B &= ~((1<<CS12)|(1<<CS11));
TCCR0B |= 1<<CS00;
TCCR0B &= ~((1<<CS02)|(1<<CS01));
и теперь:
-на 5 и 6 выводе ардуино(таймер0 11 и 12 вывод контроллера)
-на 9 и 10 выводе (тамер1 15 и 16 контроллера )
должно быть 32кГц против 500гц по умолчанию , разница заметна сразу- никаких мерцаний в глазах .Соответственно третий таймер я не трогал- он для ИК приема у меня
Но тут надо учитывать, что ломаются функции millis() and delay() — значения надо умножать на 64
"The Arduino performs some initialization of the timers. The Arduino initializes the prescaler on all three timers to divide the clock by 64. Timer 0 is initialized to Fast PWM, while Timer 1 and Timer 2 is initialized to Phase Correct PWM. See the Arduino source file wiring.c for details.
The Arduino uses Timer 0 internally for the millis() and delay() functions, so be warned that changing the frequency of this timer will cause those functions to be erroneous. Using the PWM outputs is safe if you don't change the frequency, though. "
более подробно про PWM arduino
arduino.cc