Hi.
I'm using digital servo XQ-S5040D. And I have 1 question:
While servo is powered on, I'm detaching the control wire but it still continue to keep it position, even if I will move the servo manually a little. Is it possible to send some impulse or commande to servo to disable to keep it's position.
That is one of the "features" of some of the digital servos. They internally generate the internal control pulses based on a received control pulse. They continue the last received control pulse until an new command is received. This might be changed by reprogramming the internal digital programming. The servo maker should have the info.
Do you want the servo to be moveable by hand, or do you want it to return to some position?
I would expect servo.detach() to make it moveable by hand.
...R
Thanks for your answer. I've used servo.detach, but it doesn't help.
Here is the code, maybe I can find something to resolve my problem.
#include <Servo.h>
#define PirPin 13
#define ServoPin 10
Servo myServo; // Объект Servo
int val=0;
int pos=1;
int flag=0;
void setup() {
pinMode(PirPin, INPUT);
}
void loop() {
val = digitalRead(PirPin);
pos = myServo.read();
if (flag==0 && val==HIGH){
myServo.attach(ServoPin);
flag=1; // Attach and apply power
for(pos = 180; pos >= 16; pos -= 2) //open door
{
myServo.write(pos); // Move to next position
delay(60); // Short pause to allow it to move
}
myServo.detach();
delay(2000);
}
if (flag==1 && val==LOW){
myServo.attach(ServoPin); // Attach and apply power
flag=0;
for(pos = 14; pos <= 180; pos += 2) //close door
{
myServo.write(pos); // Move to next position
delay(100); // Short pause to allow it to move
}
myServo.detach();
delay(2000);
}
}