サイコン用プログラム BLE通信送信確認

Dependencies:   mbed BLE_API nRF51822

Revision:
16:e2386ded5c74
Parent:
15:f0306f9dc7ad
Child:
17:e7c43d1b362f
--- a/main.cpp	Mon May 25 15:44:28 2015 +0000
+++ b/main.cpp	Tue May 26 16:39:02 2015 +0000
@@ -167,15 +167,15 @@
     if (params->charHandle == writeChar.getValueAttribute().getHandle()) {
         uint16_t len = params->len;
         
-        if (len == 3) {
-            uint8_t controller[3] = {0};
+        if (len == 2) {
+            uint8_t controller[2] = {0};
 
             ble.readCharacteristicValue(writeChar.getValueAttribute().getHandle(), writePayload, &len);
             memcpy(controller, writePayload, sizeof(controller));
             
             //pc.printf("write: %u, %u, %u\r\n", controller[0],controller[1],controller[2]);   
             
-            switch(controller[1]){
+            switch(controller[0]){
                 case 0:
                     acceleroRange = MPU6050_ACCELERO_RANGE_2G;
                     break;
@@ -193,7 +193,7 @@
                     break;  
             }
             
-            switch(controller[2]){
+            switch(controller[1]){
                 case 0:
                     gyroRange = MPU6050_GYRO_RANGE_250;
                     break;