Servo driver for the Adafruit 16 channel PWM I2C module
Dependents: theRobot theRobotNEW theRobot theRobot ... more
Fork of Adafruit-PWM-Servo-Driver by
Diff: Adafruit_PWMServoDriver.cpp
- Revision:
- 2:88bdd5c4e77b
- Parent:
- 1:69033d5e289b
--- a/Adafruit_PWMServoDriver.cpp Mon Aug 19 08:35:11 2013 +0000 +++ b/Adafruit_PWMServoDriver.cpp Wed Sep 04 03:58:53 2013 +0000 @@ -91,7 +91,10 @@ write8(LED0_OFF_H+4*num, off >> 8);*/ } +// Set pwm duty in us order void Adafruit_PWMServoDriver::setDuty(uint8_t num, uint16_t duty) { + float pulselength = 10000; // 10,000 us per second + duty = 4094 * duty / pulselength; setPWM(num, 0, duty); }