Harmandeep Dubb
Harmandeep Dubb

Reputation: 149

Seeed Studio XIAO nRF52840 communicationg with Phone app over bluetooth

I am trying to communicate with the nRF Connect App on my iphone using the Nordic UART Service through the Bluefruit wrap developed by Adafruit.

The below pictures show:

  1. the device is being recognized by the app
  2. shows the Nordic UART Service present

enter image description here

enter image description here

At this point many tutorials show that you are able to send serial bytes from the app to the module through some sort of input menu however for myself this is not the case. (one example of a tutorial is here: https://how2electronics.com/send-receive-data-to-mobile-app-with-xiao-ble-nrf52840-sense/) I try to click on the Nordic uart service box and nothing happens.

The below is the basic code I am using to develop for the nodule in the Arduino IDE:

#include <bluefruit.h>

BLEUart bleuart; // BLE UART service

void setup() {
  Serial.begin(115200);
  Bluefruit.begin();
  Bluefruit.setTxPower(4);    // Check maximum power is compliant in your region
  Bluefruit.setName("XIAO_BLE");

  bleuart.begin();

  // Start advertising BLE. It will start broadcasting so that we can connect from a phone app
  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
  Bluefruit.Advertising.addTxPower();
  Bluefruit.Advertising.addService(bleuart);
  Bluefruit.Advertising.start(0);  // 0 = Don't stop advertising after a connection
}

void loop() {
  // Forward messages between Serial and BLE UART
  while (bleuart.available()) {
    char c = bleuart.read();
    Serial.print(c);
  }

  while (Serial.available()) {
    char c = Serial.read();
    bleuart.write(c);
  }
}

I have tried the premade examples that come with the bluefruit BLE library and the behavior is consistent.

Does anyone have an idea why the app is not allow me to communicate with the module as intended?

Upvotes: 0

Views: 383

Answers (0)

Related Questions