I have a main loop like this:
void loop() {
ArduinoCloud.update();
// Your code here
}
Everything happens in the callback functions, like:
void onBassToneChange() {
// Add your code here to act upon BassTone change
if (discant_tone <= bass_tone)
{
// move discant mallet out of way
discant_tone = bass_tone + 1;
servobank->setPWM(14, angles[1][discant_tone][0]);
}
servobank->setPWM(12, angles[0][bass_tone][0]);
Serial.println("bass tone change");
bass_horiz = angles[0][bass_tone][0];
bass_higher = angles[0][bass_tone][1];
bass_lower = angles[0][bass_tone][2];
}
I get the "bass tone change" message in my serial monitor, showing that the callback is working. But what is not working is the servobank->setPWM() call. My servos are dead! They work in the setup() function, where the servobank is initiated (PCA9685_RT lib) and I place the servos in their initial positions. But when the program advances to the loop() part, the servos die. I guess it has to do with the ArduinoCloud.update() call. Would it help to put a delay, or is the Cloud in a total conflict with the PCA9685_RT lib? Yes, I should be testing that, but I'm not at the workshop right now.