XYZ platform including 3 motors and 8 magnetometers (LIS3MDL).

Fork of XYZ_sensor_Platform by Shih-Ho Hsieh

Revision:
13:1aa1d5ec949b
Parent:
12:e2b7e030193c
Child:
14:1363e4b2fbac
--- a/xyz_sensor_platform.h	Fri Mar 02 06:40:16 2018 +0000
+++ b/xyz_sensor_platform.h	Tue Mar 06 08:35:33 2018 +0000
@@ -7,6 +7,7 @@
 #include "motor.h"
 #include "motor_targets.h"
 #define MOTOR_INITIAL
+#define CALIBRATION_TIME 400
 
 /*** Typedefs ----------------------------------------------------------------- ***/
 typedef struct {
@@ -84,8 +85,12 @@
     void y_end();
     void z_zero();
     void z_end();
+    void checkMovedTimes(){
+        if(movedTimes++>=CALIBRATION_TIME) reset();
+    }
     Motor *motorX, *motorY, *motorZ;
     float x,y,z;
+    int movedTimes;
     bool is_x_end, is_y_end, is_z_end, is_x_zero, is_y_zero, is_z_zero;
     InterruptIn xZero, xEnd, yZero, yEnd, zZero, zEnd;
     AltIMU_10_v5 *sensor;