PWM Routine and

I wrote a routine which writes PWM to some shift register outputs for driving motor start and stop phase.
This routine is without delay but will run for the desired time to drive the current up slowly which couls be 0,5-3 Seconds.

I fear including could sometimes (maybe when connection gets lost) delay the PWM routine therefore stopping or starting the motor abbruptly so I didn’t include it in that routine.

Is there some way to use my pwm routine along with blynk or do I have to take the chance to loose connection?

1 Like

0,5-3 seconds delay may or may not cause troubles… Depends on the hardware.
Anyway, if you have frequent delays, it will just cause blynk messages not processed in time, and it will break something.
Probably the best way is to learn coding hardware interrupt timer in such cases -> which is not that easy.

Alternatively, you could bring another small dedicated microcontroller into the system, just for this intensive function.

I did want to use timer interrups for that but my problem is on the ESP (at least for what I read until now) Timer 1 is used by WiFi and Timer 2 is only software.

So there’s no hardware timer I can use as far as I know till now.

But this will be my next thin to investigate deeper…

Also I did want to use the Watchdog timer for some other task but as far as I read you can’t really use the hardware Watchdog on the ESP.