netlabtoolkit / VarSpeedServo

Arduino library for servos that extends the standard servo.h library with the ability to set speed, and wait for position to complete
GNU Lesser General Public License v2.1
289 stars 127 forks source link

Motor Reset when I use attach function. #14

Open gargakshit opened 7 years ago

gargakshit commented 7 years ago

My servo comes to 0 when I use attach function.

Here is the code I used:

include

VarSpeedServo test;

void setup() { // put your setup code here, to run onc test.attach(2); }

void loop() { // put your main code here, to run repeatedly: }

MatanRubin commented 7 years ago

I'm seeing the same issue - servo resets position when calling attach(), instead of just staying where it is. Except for this issue this library is great - exactly what I was looking for - thanks!

jackdewhurst commented 7 years ago

Same here, unfortunately this makes the library unusable for my project :-(.

gargakshit commented 7 years ago

ISSUE

This problem also occurs with the standard Servo library, also this library is an extension of the Standard Servo library, so the developer might not fix it...

I got a fix. Get the approximate location where the servo is and write that value after it in the setup() function after calling attach() function. It worked for me...

I am closing the ISSUE here, comments are still open. People are requested to keep the thread alive...

pvanallen commented 7 years ago

Hi @gargakshit, thanks for clarifying, and offering a work-around. I'm the owner of the library. I will admit that I have not had time recently to work on this repo. I'm am looking for someone to help resolve some of the other open issues and pull requests.

gargakshit commented 7 years ago

@pvanallen Sir, should I re-open the issue???

jackdewhurst commented 7 years ago

@gargakshit this issue does not occur for me using the standard Servo library.

When I use write() directly after attach() it still moves to 0 before moving to the desired value, even when wait = false. This doesn't happen using the Servo library.

I've remedied it by exposing DEFAULT_PULSE_WIDTH from the library, reading the servo position then setting it before calling attach().

gargakshit commented 7 years ago

@jackdewhurst Hey, thanks for the update. This solved the issue.

Thanks Again

Sent from my YU5010 using FastHub

pvanallen commented 7 years ago

@jackdewhurst, @gargakshit I've reopened this issue - Jack, could you submit a pull request and I'll integrate it? Or just post the changes. Thanks!

gargakshit commented 6 years ago

What's the status???

pvanallen commented 6 years ago

@gargakshit Could you post the code you used to resolve this?

cape commented 6 years ago

Hi, I am having the same issue. when attach a servo, the servo moves to 0. I need to avoid this, thanks

sapics commented 4 years ago

I create the PR to fix this issue. I have not tested the PR yet, because I don't have servo motor. It would be helpful, if you could test it.