2727//
2828// Servo - Class for manipulating servo motors connected to Arduino pins.
2929//
30- // attach(pin ) - Attaches a servo motor to an i/o pin.
31- // attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
30+ // attach(pin) - Attaches a servo motor to an i/o pin.
31+ // attach(pin, min, max) - Attaches to a pin setting min and max values in microseconds
3232// default min is 1000, max is 2000
3333//
3434// write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
4444
4545#include < Arduino.h>
4646
47- // the following are in us (microseconds)
48- //
47+ // The following values are in us (microseconds).
48+ // Since the defaults can be overwritten in the new attach() member function,
49+ // they were modified from the Arduino AVR defaults to be in the safe range
50+ // of publically available specifications. While this implies that many 180°
51+ // servos do not operate the full 0° to 180° sweep using these, it also prevents
52+ // unsuspecting damage. For Arduino AVR, the same change is being discussed.
4953#define DEFAULT_MIN_PULSE_WIDTH 1000 // uncalibrated default, the shortest duty cycle sent to a servo
5054#define DEFAULT_MAX_PULSE_WIDTH 2000 // uncalibrated default, the longest duty cycle sent to a servo
5155#define DEFAULT_NEUTRAL_PULSE_WIDTH 1500 // default duty cycle when servo is attached
@@ -64,12 +68,13 @@ class Servo
6468 Servo ();
6569 ~Servo ();
6670 // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure.
71+ // returns channel number or 0 if failure.
6772 uint8_t attach (int pin);
68- // attach the given pin to the next free channel, sets pinMode, min, and max values for writes .
73+ // attach the given pin to the next free channel, sets pinMode, min, and max values for write() .
6974 // returns channel number or 0 if failure.
7075 uint8_t attach (int pin, uint16_t min, uint16_t max);
71- // attach the given pin to the next free channel, sets pinMode, min, max values for writes ,
72- // and sets the initial value, the same as write.
76+ // attach the given pin to the next free channel, sets pinMode, min, and max values for write() ,
77+ // and sets the initial value, the same as write() .
7378 // returns channel number or 0 if failure.
7479 uint8_t attach (int pin, uint16_t min, uint16_t max, int value);
7580 void detach ();
0 commit comments