I'm using a MKR and a Adafruit DotStar Digital LED Strip.
Now programming is working, but i always lose connection with IOT CLOUT!
Spent some time debugging what the reason is.
this is the loop to debug.
int counter;
void loop() {
ArduinoCloud.update();
//
counter++;
if (millis() - hartbeat > 1000) {
hartbeat = millis();
zet_bar();
Serial.print("time zet_bar ");
Serial.println(millis()-hartbeat);
Serial.print("loop run ");
Serial.println(counter);
counter=0;
}
}
20 times per second seems like a reasonable number to me bearing in mind that you are calling your zet_bar() function (which will take some time to run) and serial port is printing.
Anyway, this shouldn't be the cause of your connectivity issue with the cloud. What's exactly the error you get?
Can you set the debug level in the setup() function to 4 and share the error messages?
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(4);
ArduinoCloud.printDebugInfo();
my zet_bar() function takes 4 milliseconds, not a lot of time.
In the logging, i see just disconnected from and connected to IOT.
This for a while and after a couple of minutes a reset of the board.