Skip to content

Fix for advertised service data not working#29

Merged
facchinm merged 1 commit intoarduino-libraries:masterfrom
sandeepmistry:service-data-fixes
Aug 17, 2020
Merged

Fix for advertised service data not working#29
facchinm merged 1 commit intoarduino-libraries:masterfrom
sandeepmistry:service-data-fixes

Conversation

@sandeepmistry
Copy link
Contributor

Test sketch:

#include <ArduinoBLE.h>

BLEService myService("fff0");
BLEIntCharacteristic myCharacteristic("fff1", BLERead | BLEBroadcast);

int count = 0;

void setup() {
  Serial.begin(9600);
  while (!Serial);

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

  myService.addCharacteristic(myCharacteristic);
  BLE.addService(myService);

  BLE.setAdvertisedService(myService);
  BLE.advertise();

  Serial.println("advertising ...");

  myCharacteristic.broadcast();
}

void loop() {
  BLE.poll();

  count++;

  myCharacteristic.writeValue(count);


  delay(100);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants