No connection to characteristic

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Ceranthor
 
Posts: 5
Joined: Wed Aug 04, 2021 6:09 am

No connection to characteristic

Post by Ceranthor »

Hi.
I need to connect adafruit feather to arduino nano BLE over bluetooth.
On arduino nano i have Service and characteristic added to this service (i can see them on NRF connect app on the phone). Adafruit feather sense is my central device and i cannot make it to connect and read characteristic from arduino nano 33 ble.

Code: Select all

#include <bluefruit.h>

const char* deviceServiceUuid = "19b10000-e8f2-537e-4f6c-d104768a1214";
const char* deviceServiceCharacteristicUuid = "19b10001-e8f2-537e-4f6c-d104768a1214";
BLEClientService maglyService(deviceServiceUuid);
BLEClientCharacteristic MaglyCharacteristic(deviceServiceCharacteristicUuid);


void setup() {
  Bluefruit.begin(0, 1);
  Bluefruit.setName("A central");
  maglyService.begin();
  MaglyCharacteristic.begin();

  Bluefruit.setConnLedInterval(250);
  Bluefruit.Central.setDisconnectCallback(disconnect_callback);
  Bluefruit.Central.setConnectCallback(connect_callback);
  Bluefruit.Scanner.setRxCallback(scan_callback);
  Bluefruit.Scanner.restartOnDisconnect(true);
  Bluefruit.Scanner.setInterval(160, 80);
  Bluefruit.Scanner.filterUuid(maglyService.uuid);
  Bluefruit.Scanner.useActiveScan(true);
  Bluefruit.Scanner.start(0);
}

void loop() {

  Serial.println("STILL NOTHING");
  while (Bluefruit.connected()) {
    delay(100);
    //Serial.println(MaglyCharacteristic.discovered());
    byte pom[60];
    MaglyCharacteristic.read(pom,60);
    Serial.write(pom,60);
    Serial.println();

  }

}

void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
  (void) conn_handle;
  (void) reason;
}

void connect_callback(uint16_t conn_handle) {

}
void scan_callback(ble_gap_evt_adv_report_t* report) {
  Bluefruit.Central.connect(report);
  Serial.println("Central Connected");
  MaglyCharacteristic.discover();
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”