micro:bitにRCBControllerを接続するサンプルプログラム。 接続が不安定。micro:bitの電源入り切りやリセットSW押下を何度か試せば接続できるかも。
Fork of BLE_GATT_Example by
Diff: main.cpp
- Revision:
- 11:b59226338001
- Parent:
- 10:6acaa9f0ef85
- Child:
- 12:6d1f77d0cb37
diff -r 6acaa9f0ef85 -r b59226338001 main.cpp --- a/main.cpp Tue Mar 10 15:11:10 2015 +0000 +++ b/main.cpp Wed Mar 11 14:23:25 2015 +0000 @@ -43,14 +43,14 @@ // toggle LED if only 1 byte is written if(params->len == 1) { led = params->data[0]; + (params->data[0] == 0x00) ? printf("\n\rled on ") : printf("\n\rled off "); // print led toggle } // print the data if more than 1 byte is written else { - printf("0x"); + printf("\n\r Data received: length = %d, data = 0x",params->len); for(int x=0; x < params->len; x++) { printf("%x",params->data[x]); } - printf("\n\r"); // print newline } // update the readChar with the value of writeChar ble.updateCharacteristicValue(readChar.getValueHandle(),params->data,params->len);