Hey!
Trying to control a wireless headset (Beats Studio 3) I've tried a simple example written in the doc of ArduinoBLE's library. (ArduinoBLE - bleDevice.connect() - Arduino Reference)
Even tho it detects the headset, can print its Mac Adress and all that, the peripheral.connect() keeps returning false.
Any idea of what I'm doing wrong?
Here's my entire code :
#include <ArduinoBLE.h>
void setup() {
Serial.begin(9600);
while (!Serial);
if (!BLE.begin()) {
Serial.println("Error while trying to initialise BLE module");
while (1);
}
Serial.println("Scanning for BLE devices...");
BLE.scan();
}
void loop() {
BLEDevice peripheral = BLE.available();
if (peripheral) {
if (peripheral.address().equalsIgnoreCase("94:F6:D6:F3:03:4A")) { // Just to connect to the desired headset and nothing else.
Serial.println("Trying to connect to Beats Studio 3:");
BLE.stopScan();
if (peripheral.connect()) {
Serial.println("Connected to device!");
} else {
Serial.println("Oops!");
BLE.scan();
}
}
}
}
Thanks in advance!