Skip to content

Commit 12d0baa

Browse files
authored
Correct erroneous comment re: Servo::attach return
The comment claimed that 0 was returned by `Servo::attach` on failure. This is incorrect. The return value is the channel number, which is 0 for the `Servo` object that is instantiated first. Instead, `INVALID_SERVO` (defined as 255) is returned on failure.
1 parent f361766 commit 12d0baa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Servo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class Servo
105105
{
106106
public:
107107
Servo();
108-
uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure
108+
uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or INVALID_SERVO if failure
109109
uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
110110
void detach();
111111
void write(int value); // if value is < 200 its treated as an angle, otherwise as pulse width in microseconds

0 commit comments

Comments
 (0)