ESP32 BLE - Server. Start / Stop data streaming from client

void setup() {
  Serial.begin(115200);
  Serial.println("Starting BLE work!");

  BLEDevice::init("Long name works now");
  BLEServer *pServer = BLEDevice::createServer();
  BLEService *pService = pServer->createService(SERVICE_UUID);
  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         CHARACTERISTIC_UUID,
                                         BLECharacteristic::PROPERTY_READ |
                                         BLECharacteristic::PROPERTY_WRITE
                                       );

  pCharacteristic->setValue("Hello World says Neil");
  pService->start();
  // BLEAdvertising *pAdvertising = pServer->getAdvertising();  // this still is working for backward compatibility
  BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->addServiceUUID(SERVICE_UUID);
  pAdvertising->setScanResponse(true);
  pAdvertising->setMinPreferred(0x06);  // functions that help with iPhone connections issue
  pAdvertising->setMinPreferred(0x12);
  BLEDevice::startAdvertising();
  Serial.println("Characteristic defined! Now you can read it in your phone!");
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(2000);
}

Using the above I want to send two channel sensor data to client based on a Start / Stop signal from the client. Need help doing it. Thanks.

Are you hoping that forum members will replace that comment with a bunch of carefully crafted code?

Sorry to piss you off.

Generally I come here to get support or topics that I cannot grasp or understand. Not that I have a homework and want members to do it. If you have time , you can check some of my earlier requests for help . Anyway thats what i think and have no intention of changing your view on me.

The forum rules are very clear: members help people with problems with their code. "Fill in the blank" will not go over well.

If you want someone to write code for you, post on the Jobs and Paid Consultancy forum section.

Read my post. I wanted help. And thats what you also agree this forum is for. The definition of Help is subjective. At least in this instance.

With that note lets leave it at that . Tks.

Ok problem solved. The example I should have started is the BLE_notify and not the BLE_server. I see that anything with BLE deals with arrow operators - not used them so far and hence the initial stumble.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.