Teensy 3.2 not populating serial monitor when using Adafruit_PWMServoDriver

To all,

I am using a Teensy 3.2 to control an Adafruit product #815 16 Channel 12 Bit PWM servo driver. The code below works fine, but when I try to use the serial monitor, nothing populates. If I rim out the two “Wire.set” lines and upload to an UNO, the serial monitor works fine. I believe this to be an issue with the Adafruit_PWMServoDriver library clashing with the 3.2 in some way. Any help or insight on this would be greatly appreciated as my final project will most definitely need to use a Teensy. Also, this is my first post to a Forum ever, so please help direct me if my post need better explanation. Thanks!

Adafruit 815: Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Adafruit_PWMServoDriver library: https://github.com/adafruit/Adafruit…Driver-Library
Teensy 3.2
Windows 10 with Arduino IDE 1.8.13

Code Below:

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

int analogPin = A0;

int val = 0;

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40, Wire);

void setup() {

Serial.println(“16 channel PWM test!”);

pwm.setPWMFreq(1000); // This is the maximum PWM frequency




void loop() {

int sensorValue = analogRead(A0);


for (uint16_t i=0; i<4096; i += 1) { //replaced 8 with 1
for (uint8_t pwmnum=0; pwmnum < 16; pwmnum++) {
pwm.setPWM(pwmnum, 0, (i + (4096/16)*pwmnum) % 4096 );



Are you saying that code fails on a Teensy and works on an Uno. I’m not clear whether you had to comment out Wire for both.

The serial monitor works on the UNO and fails on the Teensy. Serial monitor works on the teensy until I use the “Adafruit_PWMServoDriver” library.

I’ll guess that whatever timer Adafruit is using to run the wire protocol timing is being used by the Teensy for serial, but you would need to dig into the library code to see.

You always have the Teensy forum as an option for direct support.


Thanks all for the input. I was putting my “Serial.writeln” before the for loop. This loop was taking forever due to it’s size. I have figured it out and have everything up and running. Thanks!