Skip to content

Commit 3a2a56b

Browse files
committed
getPWM added
1 parent c057d9d commit 3a2a56b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Adafruit_PWMServoDriver.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ void Adafruit_PWMServoDriver::setPWMFreq(float freq) {
158158
#endif
159159
}
160160

161+
/*!
162+
* @brief Gets the PWM output of one of the PCA9685 pins
163+
* @param num One of the PWM output pins, from 0 to 15
164+
*/
165+
void Adafruit_PWMServoDriver::getPWM(uint8_t num) {
166+
_i2c->requestFrom((uint8_t)_i2caddr, LED0_ON_L + 4 * num, 4)
167+
return _i2c->read();
168+
}
169+
161170
/*!
162171
* @brief Sets the PWM output of one of the PCA9685 pins
163172
* @param num One of the PWM output pins, from 0 to 15

Adafruit_PWMServoDriver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Adafruit_PWMServoDriver {
5555
void wakeup();
5656
void setExtClk(uint8_t prescale);
5757
void setPWMFreq(float freq);
58+
void getPWM(uint8_t num);
5859
void setPWM(uint8_t num, uint16_t on, uint16_t off);
5960
void setPin(uint8_t num, uint16_t val, bool invert=false);
6061

0 commit comments

Comments
 (0)