You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Servo_Hardware_PWM.h
+12-7Lines changed: 12 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -69,14 +69,19 @@ class Servo
69
69
{
70
70
public:
71
71
Servo();
72
-
uint8_tattach(int pin); //attach the given pin; returns servoIndex number or 255 if too many servos
73
-
voiddetach(); //detach the used pin
74
-
voiddetachAll(); //automatically detaches all used pins
75
-
voidwrite(int value); //write angle in degrees
76
-
voidwriteMicroseconds(int value); //write pulse width in microseconds
72
+
uint8_tattach(int pin); //attach the given pin; returns servoIndex number or 255 if too many servos
73
+
uint8_tattach(int pin, int min, int max); //attach the given pin and set the upper and lower pulse width limits; returns servoIndex number or 255 if too many servos
74
+
uint8_tattach(int pin, int min, int max, int defaultPos); //attach the given pin, set the upper and lower pulse width limits and set the pulse width when servo is attached; returns servoIndex number or 255 if too many servos
75
+
voiddetach(); //detach the used pin
76
+
voiddetachAll(); //automatically detaches all used pins
77
+
voidwrite(int value); //write angle in degrees
78
+
voidwriteMicroseconds(int value); //write pulse width in microseconds
77
79
private:
78
-
uint8_t servoIndex; //number of attached Servos
79
-
uint8_t servoPin; //pin number of the attached Servo
80
+
uint8_t servoIndex; //number of attached Servos
81
+
uint8_t servoPin; //pin number of the attached Servo
82
+
uint16_t min; //lower pulse width limit
83
+
uint16_t max; //upper pulse width limit
84
+
uint16_t defaultPos; //pulse width when servo is attached
0 commit comments