![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Wallbot_CaaS
Dependencies: MPU6050 mbed PID
Fork of BLE_MPU6050_test6_challenge_sb by
Diff: main.cpp
- Revision:
- 21:14cf80622dd5
- Parent:
- 20:b0e1fa37856d
--- a/main.cpp Fri May 25 04:52:06 2018 +0000 +++ b/main.cpp Mon Jun 04 01:41:37 2018 +0000 @@ -158,8 +158,9 @@ wb._calibratedMaximum[i] = 900; } */ - +#ifndef DEBUG wb.auto_calibrate(); //自動キャリブレーション +#endif #ifdef DEBUG for(int i = 0 ; i < 4 ; i++) { @@ -180,9 +181,17 @@ //速度制御 //wb.control_enable(true); - //wb.SetRPM(-30,30); - + //Timer time; + //int now; + //time.start(); while (true) { + ///////////////////PID調整 + //now = time.read(); + //if((now % 10) == 0){ + // pc.printf("set RPM %d ",now % 50 +10); + // wb.SetRPM(now % 50 +10,now % 50 +10); + //} + /////////////////////// //センサ値の取得 line = wb.GetLinePosition(); @@ -205,7 +214,8 @@ // #ifdef DEBUG - pc.printf("Pulse(%d,%d) RPM(%.2f,%.2f) ",wb._left_pulses,wb._right_pulses,lrpm, rrpm); + pc.printf("Pulse(%d,%d)",wb._left_pulses,wb._right_pulses); + pc.printf("RPM(%.2f,%.2f)",lrpm, rrpm); pc.printf("LinePos:%d ",line); pc.printf("Sens(%d,%d,%d,%d)",wb.sensor_values[0],wb.sensor_values[1],wb.sensor_values[2],wb.sensor_values[3]); pc.printf("MPU(%d,%d,%d, %d,%d,%d)",mpu_a[0],mpu_a[1],mpu_a[2],mpu_g[0],mpu_g[1],mpu_g[2]);