Nano 33 IOT is rebooting constantly after 13 seconds when I start playing audio via audiozero library. i have stripped pretty much everything from my script in an attempt to identify the cause of the reboot and it seems to be related to running both " AudioZero.play(myFile);" and the arduino cloud update/OnCloudChange at the same time. both of these work fine on their own and if i comment out either one i don't get the reboot but if they are both there the device will reboot every 13 seconds. When it reboots it does get through the script, the audio plays but only for a few seconds and the it powers off and back on. if i remove the cloud stuff it will play the audio all they way through the 2min WAV. if i remove the play command from audiozero it will stay up and online (connected to the WIFI) indefinitely.
could this be a bug in the audiozero library? i have never had trouble with it but this is the first time i have tried to use it in conjunction with the Arduino cloud stuff.
#include <SD.h>
#include <SPI.h>
#include <AudioZero.h>
#include "thingProperties.h"
void setup() {
// debug output at 115200 baud
Serial.begin(115200);
// setup SD-card
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println(" failed!");
while(true);
}
Serial.println(" done.");
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
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(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
int count = 0;
// open wave file from sdcard
File myFile = SD.open("rain.wav");
// 44100kHz stereo => 88200 sample rate
AudioZero.begin(2*44100);
if (!myFile) {
// if the file didn't open, print an error and stop
Serial.println("error opening rain.wav");
while (true);
}
Serial.print("Playing");
// until the file is not finished
AudioZero.play(myFile);
// AudioZero.close();
Serial.println("End of file. Thank you for listening!");
while (true) ;
}
void onCloudChange() {
// Do something
}