1

I have been going through a tutorial about this, based on the example code for the "BTLE" Arduino Library.

This is my program:

#include <SPI.h>
#include <RF24.h>
#include <BTLE.h>

RF24 radio(9,10);
BTLE btle(&radio);

void setup() {
  Serial.begin(9600);
  while (!Serial) { }
  Serial.println("BTLE advertisement receiver");
  btle.begin("");
}

void loop() {
  if (btle.listen()) {
    Serial.print("Got payload: ");
    for (uint8_t i = 0; i < (btle.buffer.pl_size)-6; i++) {
      Serial.print(char(btle.buffer.payload[i]));
    }
    Serial.println("");
  }
  btle.hopChannel();
}

I saw a video of a person running this code, and then sending advertising information via the "nRF Connect" Android app. In that video (https://www.youtube.com/watch?v=DGgjdBSId4Y) they would receive output in the Serial Monitor very regularly, as I would expect. When I run my code, and start advertising, then I see the name of my phone only every other minute in the output, and between that time, there is a lot of garbage. I cannot copy the output because of too many special characters.

I would expect the string that I am advertising to show up approximately every 100ms, as that is the rate of the advertisement.

Any idea what I could be doing wrong, or how to debug this better?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.