Skip to content

Can't control a servo once detach()ed (2.0.0-rc2) #1133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kotobuki opened this issue Dec 3, 2015 · 8 comments
Closed

Can't control a servo once detach()ed (2.0.0-rc2) #1133

kotobuki opened this issue Dec 3, 2015 · 8 comments

Comments

@kotobuki
Copy link

kotobuki commented Dec 3, 2015

The following code works as expected with my Arduino Uno board, but doesn't work with my ESP8266 based board. Once a servo is detached, the code can't control the servo anymore. According to the Library Manager, the version of the Servo library is 1.1.0.

#include <Servo.h>

Servo servo;

const int servoPin = 2;

void setup() {
  servo.attach(servoPin);
  servo.write(90);
  delay(500);
  servo.detach();
  delay(500);
}

void loop() {
  servo.attach(servoPin);

  servo.write(60);
  delay(500);
  servo.write(120);
  delay(500);
  servo.write(90);

  servo.detach();
  delay(500);
}
@drewfish
Copy link

drewfish commented Dec 3, 2015

I have the same problem. I want to detach while the device is asleep.

@igrr
Copy link
Member

igrr commented Dec 5, 2015

/cc @Makuna

@Makuna
Copy link
Collaborator

Makuna commented Dec 8, 2015

I will investigate.
please confirm if you are using Stable or Staging versions.

@kotobuki
Copy link
Author

I tried with 2.0.0 rc 2 (i.e. Staging) and 2.0.0 (i.e. Stable at current moment). The library manager says the Servo library is updatable, but I couldn't update to 1.1.1 (failed).

2015-12-16 22 32 57

@Makuna
Copy link
Collaborator

Makuna commented Dec 16, 2015

@kotobuki I am unsure if the servo library you are references above is even supported on ESP.

The Servo library that works with ESP is part of the ESP Arduino package.

Thanks, I will be looking at it today.

@Makuna
Copy link
Collaborator

Makuna commented Dec 16, 2015

I have a fix and will get a pull out for it as soon as I can slay this GIT dragon that is stopping me from publishing a branch on my fork of this depot.

@geekmustafa
Copy link

pro us a time after detach and use this myservo.attach(9);
because the detach is stop servo and myservo.attach(9);
simple its like switch ^_^

@Makuna
Copy link
Collaborator

Makuna commented Sep 29, 2017

@geekmustafa Commenting on a closed issue is not a good practice. If there is an issue you are having that is related to this, create a new issue and reference this one. General questions are best asked on the gitter channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants