• I think the problem might be that when you change a software PWM value, it basically cancels the old PWM and then starts a new one - so you can get 'glitches' (the hardware handles this automatically and avoids it). The faster the frequency the less obvious the glitches are, but then the more work Espruino is having to do.

    As you're doing your interval at 15ms, so 66 fps, you probably wouldn't see flicker if you just pulsed the pins at that rate.

    How about replacing:

    analogWrite(pin, value, { freq: 600, soft:true, forceSoft:true });
    

    with a set of:

    digitalPulse(pin1, 1, value1*15);
    digitalPulse(pin2, 1, value2*15);
    digitalPulse(pin3, 1, value3*15);
    

    You might find you could use setInterval with a period of 10 (and then set 15 to 10 above as well), and that could make a be compromise?

About

Avatar for Gordon @Gordon started