Skip to content

add a servo.stop() function #127

Open
@macMikey

Description

@macMikey

think of this as something akin to an e-stop.
i have run into a situation, with the crunchlabs iturret. at power on, the turret attempts to pitch home. unfortunately, the force of that move can cause the turret to "spike" the magazine (because we don't know the power-on position of the servo, and we can't read it, either).
there are two ways to solve that problem (using this library):

  1. implement feature request: Servo class: servo.write(int angle, float rotationspeed) #71
  2. add servo.stop(). this command would act like an e-stop, cutting the signal to the servo, regardless of the .write() it is currently executing.
    i suppose my code for homing the servo would then look something like this:
for ( int i = 0 , i < 5 , i++ ) {
   servo.write (90);
   delay (5);
   servo.stop();
   delay (10);
}
servo.write(90); // just to ensure that we finally make it to 90, if the previous five moves didn't do it

in this way, the move to 90 would be broken into five moves (depending on the starting position), reducing the change in angular momentum, and still not requiring us to know the position of the servo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions