Zumy code for sending struct data
Dependencies: MPU6050IMU QEI RPCInterface mbed
Fork of zumy_mbed by
Diff: main.cpp
- Revision:
- 14:a153ce7cc4c8
- Parent:
- 13:af3e8a8189ed
- Child:
- 15:3cee564f9d47
diff -r af3e8a8189ed -r a153ce7cc4c8 main.cpp --- a/main.cpp Wed Mar 16 21:59:54 2016 +0000 +++ b/main.cpp Thu Apr 07 21:17:10 2016 +0000 @@ -28,6 +28,7 @@ DigitalOut init_done(LED1); DigitalOut imu_good(LED2); DigitalOut main_loop(LED3); +DigitalOut main_loop2(LED4); // Simon's Watchdog code from // http://mbed.org/forum/mbed/topic/508/ @@ -91,6 +92,7 @@ l_enc = l_wheel.getPulses(); //if(debug) SerialRPC.pc.printf("Pulses are: %i, %i\r\n", l_enc,r_enc); + if (!(--loop_count)) { loop_count = 10; main_loop = !main_loop; @@ -113,18 +115,22 @@ gyro_z = (float)gyroCount[2]*gRes - gyroBias[2]; } } + + // for testing where is the bug + main_loop2 = main_loop; + + //SerialRPC.pc.printf("Data: %d,%d,%f,%f,%f,%f,%f,%f\r\n", l_enc, r_enc, accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z); } } // RPCFunction void GetSensorData(char* input, char* output){ - sprintf(output, "%f,%f,%f,%f,%f,%f,%i,%i", accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z, l_enc, r_enc); - //wdt.kick(); + sprintf(output, "%d,%d,%f,%f,%f,%f,%f,%f", l_enc, r_enc, accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z); } void Reset(char* input, char* output){ - mbed_reset(); + mbed_reset(); } /*