We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a74638f commit 85a1f01Copy full SHA for 85a1f01
src/Servo_Hardware_PWM.cpp
@@ -427,15 +427,19 @@ void Servo::writeMicroseconds(int value)
427
}
428
429
430
-int read()
431
-{
+
+int Servo::read() {
432
int angle;
433
- angle = (((180 * (this->readMicroseconds() - this->min)) / (this->max - this->min));
+ angle = ((180 * (this->readMicroseconds() - this->min)) / (this->max - this->min));
434
return angle;
435
436
437
-int readMicroseconds()
438
+int Servo::readMicroseconds() {
+ if (this->servoIndex == INVALID_SERVO_NUMBER)
439
+ {
440
+ this->pulseWidth = 0;
441
+ }
442
443
return this->pulseWidth;
444
445
#endif
0 commit comments