I'm using 2 Arduino Nano 33 iot's. On one of them I've uploaded the battery service example. On the other
I've uploaded the following code which I'm hoping will detect/see the other Nano's advertised battery service.
Unfortunately, I'm not finding it, or any other "random" ble services that are in the area.
The following code just forever displays "Scanning..."
It never seems to find anything available.
Any help will be greatly appreciated!
Thank you
#include <ArduinoBLE.h>
BLEDevice peripheral;
void setup()
{
// Try to initialize BLE
if (!BLE.begin()) {
Serial.println("Terminal Error: Could not start BLE!");
while (1);
}
BLE.scan();
}
void ProcessBLE()
{
Serial.print("Scanning... ");
// check if a peripheral has been discovered
peripheral = BLE.available();
if (peripheral)
{
Serial.print("Found ");
Serial.print(peripheral.address());
Serial.print(" '");
Serial.print(peripheral.localName());
exit(1);
}
BLE.scan();
}
void loop() {
ProcessBLE();
}