-
I think my issue might've been with doing too many PWMs at once - I'm doing a very slow fade by PWMing 10 LED strips through a bank of mosfets (MDBT42Q pins D22, D20, D19, D18, D17, D25, D26, D27, D28, D29), if I do more than 3 with:
analogWrite(<PIN>, 0.1, {freq:100,soft:false} );
I get an Uncaught Error: "No free Hardware PWMs. Try not specifying a frequency, or using analogWrite(pin, val, {soft:true}) for Software PWM"
If I try forcing software PWM, if I try with more than 7 outputs like this:
analogWrite(<PIN>, 0.1, {freq:100,forceSoft:true} );
I get an Uncaught InternalError: Timeout on Utility Timer
however, just doing an analog write without an options object for all of the pins allows me to write to all of them but with a bit of a flicker to it. I'm running the LED strips with a 24v supply & I'm doing low-side switching with a bank of mosfets, but I'm powering the MDBT42Q with a separate 5v power supply with a common ground reference, so I guess there's also chance that theres some noise between my supplies.
I'm going to do a bit of digging and see if I can narrow down where the slight flicker is coming from, hopefully its just my code running a little inefficiently or a power supply thing :)
Thanks for getting back to me so quick, apologies for being slower to reply!
Do you think you could post up some example commands with what happens? It doesn't sound right but it might be something to do with the way you're using the options object...
By default analogWrite on the MDBT42Q should use hardware PWM, and there shouldn't be flicker. For example:
And for software:
But I did encounter some issues when not specifying a frequency, so perhaps that could be the problem? If so it's something I can look at fixing in a firmware update