Can RAK4630 Scan for BLE after waking up?

I want to scan BLE then send Lorawan then sleep again. But I see the example scanner only executes in the setup function and it runs continuously. When I try to scan when I wake up with the function “api.ble.scanner.start(5)”(scan for 5s) in the loop, there is a loss of the COM port. So I want to ask how to scan BLE after waking up with RAK4630 so as not to get an error?

It is a little bit tricky, but this sketch works for me.
Needs to join LoRaWAN network before it starts the BLE scans. Then it sends the found MAC addresses (limited to 10) to the LoRaWAN server.

Hope it helps.

Scan-Send-RUI3.ino (4.9 KB)

Log output:

I tried your way but it doesn’t work. In Serial monitor I just see this and nothing changes.

What is the RUI3 version? at+ver=?
As you can see it worked for me.

I tried and run it with scan with timer but when i run it the second time the board is reset. So I checked the version again and upgraded to rui3.5.3 but when I uploaded the code it returned to version 3.4.2 so I updated the Board to the correct version 3.5.3. Then try again and see that there is no reset when it comes to the next scan.
And let me ask when executing the instructions in the timer, the circuit will go back to sleep to save battery until the next timer execution, right?

With the updated RUI3 version, do you get results in the BLE scan?

Yes, once the timer handler is finished, the device goes back to sleep mode.

I got the results from the BLE scan, but i let the api start the timer right in the setup() function.

Doesn’t matter from where you start the timer.

Thank you so much for supporting me!

Glad we could help. RUI3 is still quite new.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.