Hi guys, I'm trying to connect an arduino nano 33 iot board with my pc via bluetooth. The problem is that when I go to pair and connect the arduino, the board remains "paired" and not "connected" to the pc. Someone can tell me the possible issue? This is my sketch:
#include <ArduinoBLE.h>
void setup() {
Serial.begin(9600);
if (!BLE.begin()) {
Serial.println("Errore BLE!");
while (1);
}
BLE.setLocalName("Nano 33 IoT");
BLE.advertise();
}
void loop() {
BLEDevice central = BLE.central();
if (central) {
Serial.print("Connected to central: ");
Serial.println(central.address());
}
}
Please first have a look at the examples provided in the library and in the forum. Your example is not sufficient to create a BLE peripheral.
You cannot pair a BLE device with the ArdunioBLE library. Pairing is an optional security feature in BLE and not supported. You can only connect from an app not the OS.
Next use a smartphone app to test your BLE peripheral first. I like BLE Scanner on iOS. There are many others on iOS and Arduino.
BLE support on Windows is not good. What software do you intend to use?
Please try to be very specific when you provide information. Bluetooth is a term describing two incompatible protocols. The ArduninoBLE library supports only BLE and not Bluetooth classic.
Thank you for your answer. So if I understand correctly, the classic Bluetooth of the pc is incompatible with the BLE mounted on the board, right? So if I want to pass for example a data acquired from the board to my pc without using the usb connection, the only think that I can do it’s to buy another board.. in this way I can connect one board to the pc (central) and the other one can send the data via BLE to the first (peripheral). There is no other way,right? (I’m using windows 10 for your information)
This will be the easiest way. You can simply print the data into serial monitor or another terminal or write an app that reads the data from serial. There are likely Windows programs available for your use case because serial has been around for a long time.
Your Window PC very likely support Bluetooth Classic and BLE from a hardware point of view. The issue is just that the support is not great. Under Windows Bluetooth and BLE are supported for the use cases often used e.g. headset, keyboard and mouse. But there is not a lot of support for BLE for makers. Very few people use there PC with a heart rate monitor or a bicycle sensor. Most people use their smartphones for this.
You can try the Web Bluetooth API. If you are good at web programming (HTML5, CSS and Javascript). I played with it a long time ago and it was possible to create a web app to use BLE using Google Chrome.