Nucleo-transfer

Dependencies:   ADS1015 MPU6050 PixelArray PixelArray-Nucleo mbed WS2813

Fork of Nucleo-transfer by Momo Medical

Revision:
4:367af005956b
Parent:
3:cb38f2b1fd5a
Child:
5:fa879b059fd1
--- a/Sensorplate/main.cpp	Thu Sep 14 08:51:00 2017 +0000
+++ b/Sensorplate/main.cpp	Thu Sep 14 09:24:07 2017 +0000
@@ -26,36 +26,36 @@
     t.reset();
     t.start();
 
-    elec[0] = pel.readADC_SingleEnded(0);
+    elec[0] = pel.readADC_SingleEnded(0);       //First PE readout
 
     for (k = 0; k < 4; k = k + 1) {
-        res[k] =    pr1.readADC_SingleEnded(k);
+        res[k] =    pr1.readADC_SingleEnded(k); //First 4 PR readout
     }
-    while(t.read_us()<(1*(cycle_time/5))) {}
+    while(t.read_us()<(1*(cycle_time/5))) {}    //Wait untill 20% of cycle
 
-    elec[1] = pel.readADC_SingleEnded(0);
+    elec[1] = pel.readADC_SingleEnded(0);       //Second PE readout
 
     for (k = 0; k < 4; k = k + 1) {
-        res[k+4] =  pr2.readADC_SingleEnded(k);
+        res[k+4] =  pr2.readADC_SingleEnded(k); //Last 4 PR readout
     }
-    while(t.read_us()<(2*(cycle_time/5))) {}
+    while(t.read_us()<(2*(cycle_time/5))) {}    //Wait untill 40% of cycle 
 
-    elec[2] = pel.readADC_SingleEnded(0);
+    elec[2] = pel.readADC_SingleEnded(0);       //Third PE readout
 
-    agu.getAccelero(acce);
+    agu.getAccelero(acce);                      //Get accelerometer data
     angle = acce[2]*10;
     
-    while(t.read_us()<(3*(cycle_time/5))) {}
+    while(t.read_us()<(3*(cycle_time/5))) {}    //Wait untill 60% of cycle
 
-    elec[3] = pel.readADC_SingleEnded(0);
+    elec[3] = pel.readADC_SingleEnded(0);       //Fourth PE readout
 
-    agu.getGyro(gyro);
+    agu.getGyro(gyro);                          //Get gyroscope data
     
-    while(t.read_us()<(4*(cycle_time/5))) {}
+    while(t.read_us()<(4*(cycle_time/5))) {}    //Wait untill 80% of cycle
 
-    elec[4] = pel.readADC_SingleEnded(0);
+    elec[4] = pel.readADC_SingleEnded(0);       //Fifth PE readout
 
-    while(t.read_us()<(4.5*(cycle_time/5))) {}
+    while(t.read_us()<(4.5*(cycle_time/5))) {}  //Wait untill 90% of cycle
     pc.printf(",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\r\n", res[4], res[7], res[6], res[5], res[1], res[0], res[2], res[3], angle, 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
 }