Daily Shaarli

All links of one day in a single page.

March 4, 2022

Note:
/*
 * Copyright (c) 2016 Intel Corporation.  All rights reserved.
 * See the bottom of this file for the license terms.
 */

/*
 * Sketch: LedControl.ino
 *
 * Description:
 *   This is a Central sketch that looks for a particular Sevice with a
 *   certain Characteristic from a Peripheral.  Upon succesful discovery,
 *   it reads the state of a button and write that value to the
 *   Peripheral Characteristic.
 *
 * Notes:
 *
 *  - Expected Peripheral Service: 19b10000-e8f2-537e-4f6c-d104768a1214
 *  - Expected Peripheral Characteristic: 19b10001-e8f2-537e-4f6c-d104768a1214
 *  - Expected Peripheral sketch:
 *
 */

#include <CurieBLE.h>

const char* testService = "19B10000-E8F2-537E-4f6C-D104768A1214";
BLEPeripheral blePeripheral;

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

  // initialize the BLE hardware
  blePeripheral.begin();
  blePeripheral.setLocalName("Hello world BLE");
  blePeripheral.setAdvertisedServiceUuid(testService);

  Serial.println("BLE Central - LED control");
}

void loop() {
  // check if a peripheral has been discovered
  BLECentral central = blePeripheral.central();
  if (central) {
    Serial.print("Connected to central: ");
    Serial.println(central.address());
  }
  Serial.println("BLE Central - LED control");
  delay(100);
}