Skip to content

Commit 1c95302

Browse files
committed
Merge branch 'feature/adding_attached_method' into develop
2 parents 9dad172 + 75eb528 commit 1c95302

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ write KEYWORD2
1818
writeMicroseconds KEYWORD2
1919
read KEYWORD2
2020
readMicroseconds KEYWORD2
21+
attached KEYWORD2
2122

2223
#######################################
2324
# Constants (LITERAL1)

src/Servo_Hardware_PWM.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,8 @@ int Servo::readMicroseconds() {
458458

459459
return this->pulseWidth;
460460
}
461+
462+
bool Servo::attached() {
463+
return pinActive[this->servoIndex] == BOOL_TRUE;
464+
}
461465
#endif

src/Servo_Hardware_PWM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Servo
7878
void writeMicroseconds(int value); //write pulse width in microseconds
7979
int read(); //returns the current write angle in degrees
8080
int readMicroseconds(); //returns the current write angle in microseconds
81+
bool attached(); //returns true if this servo is attached, otherwise false
8182

8283
private:
8384
uint8_t servoIndex; //number of attached Servos

0 commit comments

Comments
 (0)