Library for interfacing with the NXP PCA9685 PWM controller over an I2C connection. Designed with the Adafruit breakout board (of the same name) in mind.
Diff: PCA9685.cpp
- Revision:
- 3:a3410f2f061d
- Parent:
- 2:8017239aa374
- Child:
- 4:3bcda7deb098
diff -r 8017239aa374 -r a3410f2f061d PCA9685.cpp --- a/PCA9685.cpp Thu Apr 07 20:12:00 2016 +0000 +++ b/PCA9685.cpp Thu Apr 14 16:00:40 2016 +0000 @@ -62,8 +62,20 @@ msg[3] = count_off; msg[4] = count_off >> 8; - i2c.write(ADDR, msg, 5); + i2c.write(i2c_addr, msg, 5); + +} + +void PCA9685::set_pwm_output_on_0(int pwm_output, uint16_t count_off) { + char msg[3]; + + msg[0] = LED0_ON_L + 2 + (4 * pwm_output); + msg[1] = count_off; + msg[2] = count_off >> 8; + + i2c.write(i2c_addr,msg,3); + }