aboutsummaryrefslogtreecommitdiff
path: root/libraries/Servo/Servo.cpp
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2008-08-21 23:48:38 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2008-08-21 23:48:38 +0000
commit2ed2ee36e7c51f63ecf1391bf62fcd65ad35caa5 (patch)
treea4bf1c4bb18aa51d14f82a6ee7d9cd1e6066a12c /libraries/Servo/Servo.cpp
parent1994278a7af0042efda5f01ac681c9dcdd92d38d (diff)
Moving Servo min and max parameters to the attach() function from the constructor.
Diffstat (limited to 'libraries/Servo/Servo.cpp')
-rwxr-xr-xlibraries/Servo/Servo.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libraries/Servo/Servo.cpp b/libraries/Servo/Servo.cpp
index 248a215..ac654c3 100755
--- a/libraries/Servo/Servo.cpp
+++ b/libraries/Servo/Servo.cpp
@@ -53,12 +53,19 @@ void Servo::releaseTimer1() {}
#define NO_ANGLE (0xff)
-Servo::Servo() : pin(0), angle(NO_ANGLE), min16(34), max16(150) {}
-Servo::Servo(int min, int max) : pin(0), angle(NO_ANGLE), min16(min / 16), max16(max / 16) {}
+Servo::Servo() : pin(0), angle(NO_ANGLE) {}
uint8_t Servo::attach(int pinArg)
{
+ return attach(pinArg, 544, 2400);
+}
+
+uint8_t Servo::attach(int pinArg, int min, int max)
+{
if (pinArg != 9 && pinArg != 10) return 0;
+
+ min16 = min / 16;
+ max16 = max / 16;
pin = pinArg;
angle = NO_ANGLE;