I am using Arduino IDE and programming a Seeed WIO Terminal. When I run the Bluetooth scanner it crashes after about 500 records. I added a write to SD Card to record the loops through, I hit about 92 loops and it crashes. I have used a release of memory but it doesn’t seem to release. Can someone help with this issue?
//Bluetooth scan
Serial.println(“BLE scan start”);
myFile.println(“BLE scan start”);
{
Serial.print(“Loop Count: “);
Serial.println(counter);
myFile.print(“Loop Count: “);
myFile.println(counter);
counter++;
}
BLEScanResults foundDevices = pBLEScan->start(scanTime, false); //scan for bluetooth devices and print MAC address
Serial.print(foundDevices.getCount()); //print number of bluetooth devices found
myFile.print(foundDevices.getCount()); //print number of bluetooth devices found
Serial.println(” BLE device(s) found”);
myFile.println(” BLE device(s) found”);
Serial.println(“BLE scan done!”);
myFile.println(“BLE scan done!”);
pBLEScan->clearResults(); //delete results from pBLEScan buffer to release memory
Serial.println(“Networks Found”);
myFile.println(“Networks Found”);
Serial.println(“”);
myFile.println(“”);
myFile.close();
delay(500); //wait before scanning again