BLE Connection Issues

Hey all,

I am using an Arduino Nano 33 BLE Sense Rev2 With Headers and I am having issues with the Bluetooth connections. I am new to Arduino, so I could be making a pretty simple mistake here.

Essentially what I am currently trying to do is establish a connection between my Arduino and PC, where the Arduino reports gyroscopic data to the computer. As the issue is not gyroscope related, I have removed that section of the code. Eventually, I hope to treat this device as a mouse based on gyroscope data.

Right now, once it advertises I can connect it to my PC. It will stay connected for a couple of seconds, then stay in the "Paired" state. Then, it will state "Driver Error."
image

I have completely reinstalled my drivers, and I am still having this issue. Along with this, my Laptop is not even able to discover the connection to the Arduino even though it has BLE capabilities. On my PC, I am using a Bluetooth adapter. I have not had issues using it before. For context, I am on Windows 10.

Am I doing something wrong? Or am I not using the correct hardware for something like this. Here is my code, Thanks.

#include <ArduinoBLE.h>

BLEService mouseService("1812"); // Mouse service

BLECharacteristic mouseCharacteristic("2A32", BLERead | BLENotify, 2); // Mouse characteristic

void setup() {
  Serial.begin(9600);
  
  Serial.print("Beginning BLE");

  if (!BLE.begin()) {
    Serial.println("Failed to initialize BLE!");
    while (1);
  }

  BLE.setLocalName("BLE Arduino"); // Set the local name for Bluetooth

  BLE.setAdvertisedService(mouseService); // Advertise the mouse service
  mouseService.addCharacteristic(mouseCharacteristic); // Add the mouse characteristic
  BLE.addService(mouseService); // Add the mouse service

  BLE.setPairable(0);
  BLE.advertise(); // Start advertising the BLE device

  Serial.println("Bluetooth device active, waiting for connections...");
}

void loop() {
  BLEDevice central = BLE.central();

  if (central) {
    Serial.print("Connected to central: ");
    Serial.println(central.address());

    while (central.connected()) {
      digitalWrite(LED_BUILTIN, HIGH);
      delay(50);
    }

    Serial.print("Disconnected from central: ");
    Serial.println(central.address());
  }
}

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