You are reading a single comment by @kri100s and its replies. Click here to read the full conversation.
  • Hi all,
    I am seeing the same thing after updating to cutting edge. I am using just one PWM for driving servo and updating value periodically (feedback from a pot tied to adc). The jitter with default hardware timer is massive. After selecting software is smaller, around 50us but that still means servo doesnt settle completely. Also once in a while it spikes to even bigger value.
    I used the code from one of the examples for servos:

    function setServo(pin,pos) {
     if (pos<0) pos=0;
     if (pos>1) pos=1;
     analogWrite(pin, (1+pos) / 50.0, {freq:20, forceSoft:true});
    }
    

    Ideally I would like to be able to use hardware timers as they shouldnt jitter if the timer doesnt reset or something. You can see that when you dont update periodically the PWM then its rock solid.
    I am planning to use a servo, few dc motors and a stepper so its going to be an issue.

    Is there any other way with more low level control to update PWM's values?

    Thanks

    note: I did check without adc feedback with hardcoded pwm value so it doesnt come from the pot.

About

Avatar for kri100s @kri100s started