Wallbot_CaaS
Dependencies: MPU6050 mbed PID
Fork of BLE_MPU6050_test6_challenge_sb by
Diff: main.cpp
- Revision:
- 18:8bab3e5c4ea2
- Parent:
- 17:0a7b2afd075b
- Child:
- 19:5f1e153ef63e
--- a/main.cpp Thu May 24 03:23:49 2018 +0000 +++ b/main.cpp Thu May 24 03:32:29 2018 +0000 @@ -75,8 +75,8 @@ float right_cmd; float left_cmd; - memcpy( &right_cmd, params->data , sizeof(right_cmd)); - memcpy( &left_cmd, params->data + sizeof(right_cmd) , sizeof(left_cmd)); + memcpy( &right_cmd, params->data , sizeof(right_cmd)); + memcpy( &left_cmd, params->data + sizeof(right_cmd), sizeof(left_cmd)); wb.SetRPM(left_cmd,right_cmd); #ifdef DEBUG @@ -114,8 +114,8 @@ pc.printf("MPU6050 initialize passed \n\r"); - //const uint8_t address1[] = {0xe7,0xAA,0xAA,0xAA,0xAA,0xAA}; - //ble.setAddress(Gap::ADDR_TYPE_PUBLIC, address1); + const uint8_t address1[] = {0xe7,0xAA,0xAA,0xAA,0xAA,0xAA}; + ble.setAddress(Gap::ADDR_TYPE_PUBLIC, address1); ble.init(); //イベント時のコールバック関数 @@ -146,7 +146,15 @@ //ラインセンサキャリブレーション //pc.printf("auto calibrate start\n\r"); - //wb.auto_calibrate(); + + //適当キャリブレーション + for(int i = 0 ; i < 4 ; i++) + { + wb._calibratedMinimum[i] = 300; + wb._calibratedMaximum[i] = 900; + } + + //wb.auto_calibrate(); //自動キャリブレーション #ifdef DEBUG for(int i = 0 ; i < 4 ; i++) { @@ -178,7 +186,7 @@ mpu.getAcceleroRaw(mpu_a); mpu.getGyroRaw(mpu_g); - //送信の準備 + //送信の準備(リトルエンディアン) memcpy(sen_buf ,&line,sizeof(line)); memcpy(sen_buf+sizeof(line) ,&rrpm,sizeof(rrpm)); memcpy(sen_buf+sizeof(line)+sizeof(rrpm),&lrpm,sizeof(lrpm));