This is a library for our Adafruit 16-channel PWM or any other board that uses the PCA9685 I2C PWM driver chip.

Dependents:   K9_Head_Controller

Revision:
5:9ff15661ddd6
Parent:
4:41a00db32ae7
Child:
6:a76057c4c7ac
--- a/Adafruit_PWMServoDriver.cpp	Sun Jan 05 22:29:21 2014 +0000
+++ b/Adafruit_PWMServoDriver.cpp	Tue Sep 08 16:18:49 2020 +0000
@@ -57,7 +57,7 @@
   write8(PCA9685_MODE1, newmode); // go to sleep
   write8(PCA9685_PRESCALE, prescale); // set the prescaler
   write8(PCA9685_MODE1, oldmode);
-  wait_ms(5);
+  wait_us(5000);
   write8(PCA9685_MODE1, oldmode | 0xa1);  //  This sets the MODE1 register to turn on auto increment.
                                           // This is why the beginTransmission below was not working.
   //  Serial.print("Mode now 0x"); Serial.println(read8(PCA9685_MODE1), HEX);
@@ -66,7 +66,7 @@
 void Adafruit_PWMServoDriver::setPWM(uint8_t num, uint16_t on, uint16_t off) {
   //Serial.print("Setting PWM "); Serial.print(num); Serial.print(": "); Serial.print(on); Serial.print("->"); Serial.println(off);
 
-  uint8_t data[] = { LED0_ON_L+4*num, on, on >> 8, off, off >> 8 };
+  uint8_t data[] = { (uint8_t)(LED0_ON_L+4*num), (uint8_t)on, (uint8_t)(on >> 8), (uint8_t)off, (uint8_t)(off >> 8) };
   _i2c->write(_i2caddr, (const char *)data, 5);
   /*
   WIRE.beginTransmission(_i2caddr);