i2c Motor Driver "no pwm data"

I’ve taken the example code and modified it a bit, I’m sending a serial command to the arduino and then trying to trigger the motor like this

else if(motor == “on”)
Serial.println(“sent DC speed 100”);

for some reason when I trigger this function “no pwm data” appears in the serial monitor. Am I missing something? I’m setting up the code the same way as the demo … the only thing that is different is that I’m calling this command in a function rather than in the main loop … perhaps its a serial issue?

I found the culprit … was not waiting for the setup to complete