Pilot 1 working code (excluding new patient after calculation). %d changed in %f sensordata serial log.

Dependencies:   ADS1015 MPU6050 PixelArray mbed

Fork of Momo_New by Momo Medical

Revision:
13:b85f41d6fe6f
Parent:
12:7b3a5940f911
Child:
14:3e7c3044d48b
--- a/Sensorplate/main.cpp	Thu Sep 28 14:07:12 2017 +0000
+++ b/Sensorplate/main.cpp	Thu Sep 28 14:52:14 2017 +0000
@@ -326,7 +326,7 @@
     if ((hold_timer.read_ms() > calibrationtime_ms) && calibration_flag == 0 && new_patient == 1) { // If statement for calibration system.
         calibration_flag = 1;
         calibration_flash = 11;
-        pi.printf("Calibration button is pressed.");                    // Print statement for serial communication to inform algorithm to calibrate.
+        pi.printf(">30\n");                    // Print statement for serial communication to inform algorithm to calibrate.
     }
 
     if (delay.read_ms() > delay_lock_interface) {                       // If buttons are not pressed for 3 minutes, set lock active.
@@ -347,7 +347,7 @@
     elec[4] = pel.readADC_SingleEnded(0);       //Fifth PE readout
 
     while(t.read_us()<(4.5*(cycle_time/5))) {}  //Wait untill 90% of cycle
-    pi.printf("!,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n", res[4], res[7], res[6], res[5], res[1], res[0], res[2], res[3], elec[0], elec[1], elec[2], elec[3], elec[4], acce[0]*100, acce[1]*100, acce[2]*100, gyro[0]*100, gyro[1]*100, gyro[2]*100); // print all to serial port
+    pi.printf("!,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%f,%f,%f,%f,%f,\n", res[4], res[7], res[6], res[5], res[1], res[0], res[2], res[3], elec[0], elec[1], elec[2], elec[3], elec[4], acce[0]*100, acce[1]*100, acce[2]*100, gyro[0]*100, gyro[1]*100, gyro[2]*100); // print all to serial port
     //receiving order: 8 resistive sensors, 5 electric readings, 3 accelerometer axes, 3 gyroscope axes
     
     serial_read();
@@ -450,6 +450,8 @@
     delay.reset();                                                          // Delaytimer reset en start.
     delay.start();
 
+    sample_cycle.attach_us(&read_adc, cycle_time);                          
+    
     while (1) {
         wait_us(cycle_time+1); // wait indefinitely because the ticker restarts every 50 ms
     }