• I am playing around with a servo.

    I get that I can do

    const s = require("servo").connect(B14);
    s.move(0.5, 3000);
    

    This will move the servo to position 0.5 over 3 seconds, however, it doesn't hold the position, so in this case, I am opening a chest, and once the chest is open the weight of it makes the lid slowly close again which is not what I want.

    I also get that I can do

    analogWrite(pin, (1+pos) / 50.0, {freq:20, soft: false });
    

    This will move the servo to the position taking 1 second and will hold the position, but I can't seem to find a way to set the speed/time by which it moves.
    I've tried with interval and moving it a set amount but that results in jaggery movement (I set it with an interval of 20ms, that should not be perceptible, but it was)

    Does anyone have any ideas of what I should do to get both the speed/time control, and get it to hold the position once it reaches it? :)

About

Avatar for TheLogan @TheLogan started