1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-20 21:01:25 +03:00

Moving Servo min and max parameters to the attach() function from the constructor.

This commit is contained in:
David A. Mellis
2008-08-21 23:48:38 +00:00
parent 191bb02f00
commit 44d4a4ff8a
3 changed files with 16 additions and 7 deletions

View File

@ -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;