micro:bitにRCBControllerを接続するサンプルプログラム。 接続が不安定。micro:bitの電源入り切りやリセットSW押下を何度か試せば接続できるかも。
Fork of BLE_GATT_Example by
Diff: main.cpp
- Revision:
- 12:6d1f77d0cb37
- Parent:
- 11:b59226338001
- Child:
- 13:62b1d32745ac
--- a/main.cpp Wed Mar 11 14:23:25 2015 +0000 +++ b/main.cpp Tue Mar 17 20:38:40 2015 +0000 @@ -1,11 +1,10 @@ #include "mbed.h" #include "BLEDevice.h" -#include "CustomService.h" BLEDevice ble; DigitalOut led(LED1); uint16_t customServiceUUID = 0xA000; -uint16_t reachCharUUID = 0xA001; +uint16_t readCharUUID = 0xA001; uint16_t writeCharUUID = 0xA002; const static char DEVICE_NAME[] = "ChangeMe!!"; // change this @@ -13,12 +12,10 @@ // Set Up custom Characteristics static uint8_t readValue[10] = {0}; -GattCharacteristic readChar(reachCharUUID, readValue, sizeof(readValue), sizeof(readValue), - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY); +ReadOnlyArrayGattCharacteristic<uint8_t, sizeof(readValue)> readChar(readCharUUID, readValue); static uint8_t writeValue[10] = {0}; -GattCharacteristic writeChar(writeCharUUID, writeValue, sizeof(writeValue), sizeof(writeValue), - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY); +WriteOnlyArrayGattCharacteristic<uint8_t, sizeof(writeValue)> writeChar(writeCharUUID, writeValue); // Set up custom service GattCharacteristic *characteristics[] = {&readChar, &writeChar};