Do you know how to init different channels of timers? It can barely activate half of the pwm pins with that code and aditional LED. It seems I am missing smth, but this code works almost wit every timer except TIM2:stevestrong wrote: Thu Oct 22, 2020 12:06 pm Timerx.setPeriod() is necessary if you want to output PWM signal with a specific period, not identical with your case (maximum resolution 65535).
Code: Select all
volatile bool LEDOn13 = 0;
void setup()
{
pinMode(PE2, OUTPUT);
Timer4.init();
Timer4.setPrescaleFactor(720);
Timer4.attachInterrupt(TIMER_UPDATE_INTERRUPT, func_tim_3);
Timer4.refresh();
Timer4.resume();
}
void loop()
{}
void func_tim_3()
{
digitalWrite(PE2, (LEDOn13 = !LEDOn13));
}