简体   繁体   中英

Which one do I have to use if I want to make bluetooth connection between Android app and Arduino nano 33 IOT? (BLE or Classic)

I am trying to make a android app which can make connection with Arduino nano 33 IOT device. I realized that Arduino nano 33 IOT has BLE module on it, so I used <ArduinoBLE.h> to advertise the device.

When I was making android app which can make connection with Arduino nano 33 IOT, I tried two different ways. first one is use classic bluetooth(BluetoothAdapter), and the second is use BLE bluetooth(BluetoothLeScanner).

But it is a little confusing which one I have to use. If I use classic, the App can search device but connect. If I use BLE, the App cannot even Search devices. I asked a question on stackoverflow one week ago, and a kind person answered me that I have to use BLE. So I tried it, but it is still not working...

is it ok to use classic version to make connection with BLE? or not?

You can use either BLE or classic Bluetooth on the Arduino nano 33, however, my recommendation is to use BLE as well. This is because you'll find more resources online on how to develop and use BLE, and also your application will end up using less power (hence the name BLE).

I would start with the Arduino BLE page itself which you can find here:-

https://docs.arduino.cc/tutorials/nano-33-ble-sense/ble-device-to-device

The copy the peripheral example which you can find on the page above. After that, as a sanity check, I would use the nRF Connect app on Android or iOS to make sure that the peripheral example is working as ukBaZ suggested. If everything is working by then, then you're good to start developing the Android app.

The Android app isn't going to be straight-forward but luckily there are a lot of resources that can help you get started, including the following:-

After that you should hopefully be able to connect and talk to your Arduino nano from an Android app. Remember that your Android app has to be the central that connects and reads the data, while your Arduino nano has to be the peripheral that advertises and hosts the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM