read EMG, IMU, encoder

Dependencies:   mbed

Fork of LSM9DS1_project by 曾 宗圓

Revision:
3:567765d3bcd1
Parent:
2:c889fecf9afe
--- a/main.cpp	Tue Apr 24 15:13:58 2018 +0000
+++ b/main.cpp	Wed Aug 01 01:01:13 2018 +0000
@@ -12,6 +12,7 @@
 Serial pc(USBTX, USBRX);
 Ticker timer1;
 Ticker timer2;
+DigitalOut LED(A4);            // check if the code is running
 
 float T = 0.001;
 /********************************************************************/
@@ -77,17 +78,24 @@
 
 int main()
 {
+    LED = 1;
+    wait_ms(500);
+    
     pc.baud(230400);
     setup();  //Setup sensors
     AS5145_begin(); //begin encoder
+    
+    wait_ms(500);
+    LED = 0;
+    
     init_TIMER();
     while (1)
     {
         //pc.printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%d,%d\n",pitch_angle[0],pitch_dot[0],pitch_angle[1],pitch_dot[1],pitch_angle[2],pitch_dot[2],emg_value[0],emg_value[1],emg_value[2],emg_value[3],position[1]*360/4096, position[0]*360/4096);
         wait(0.05);
         //pc.printf("%f,%f,%f,%f\n",emg_value[0],emg_value[1],emg_value[2],emg_value[3]);
-        pc.printf("%f,%f,%f,%f,%f,%d,%d\n", pitch_angle[0], pitch_angle[1], roll_angle[1], pitch_angle[2], roll_angle[2], position[1]*360/4096, position[0]*360/4096);
-        //pc.printf("IMU: %2f,%2f\r\n", pitch_angle[0], roll_angle[0]);
+//        pc.printf("%f,%f,%f,%f,%f,%d,%d\n", pitch_angle[0], pitch_angle[1], roll_angle[1], pitch_angle[2], roll_angle[2], position[1]*360/4096, position[0]*360/4096);
+        pc.printf("IMU: %2f,%2f\r\n", pitch_angle[0], roll_angle[0]);
         //pc.printf("IMU2: %2f,%2f\r\n", pitch_angle[1], roll_angle[1]);
         //pc.printf("IMU3: %2f,%2f\r\n", pitch_angle[2], roll_angle[2]);
         //pc.printf("position: %d,%d\r\n", position[0], position[1]);