Closed
Description
Hi! I have been working with the servo library and I found an strange behaviour. For example, writing the position 120 will return in the read() method a 119. Writing a 121 will return in the read() 120... So I think it is not working properly as it is returning systematically the write value -1. The Arduino documentation states that the read() method will return the previous value set in the write() function.
Here is a simple example:
#include <Servo.h>
Servo servo;
void setup(){
Serial.begin(115200);
servo.attach(D2);
}
void loop() {
servo.write(120);
Serial.println(servo.read());
delay(5000);
servo.write(121);
Serial.println(servo.read());
delay(5000);
}
The output result is like the following:
119
120
119
120
119
120
119
120
Meanwhile the expected value is
120
121
120
121
120
121
120
121
Metadata
Metadata
Assignees
Labels
No labels