C++ class for controlling DC motor with encoder feedback. Dependencies include LS7366LIB, MotCon, and PID.

Dependencies:   LS7366LIB MotCon2 PID

Dependents:   LPC1768_6axis_Arm

Revision:
12:b80cc2e27bdb
Parent:
11:93d924320ddc
diff -r 93d924320ddc -r b80cc2e27bdb Axis.h
--- a/Axis.h	Tue Nov 15 15:41:33 2016 +0000
+++ b/Axis.h	Wed Jul 11 13:47:33 2018 +0000
@@ -21,6 +21,7 @@
     void axisOn(void);
     void zero(void);
     void writeEncoderValue(long value);
+    void updatePIDgains(float P, float I, float D);
     
     long enc;       //used to return the data from the LS7366 encoder chip
     float co;       // = 0.0;
@@ -42,8 +43,11 @@
     int moveState;
     int debug;
     int *ptr_limit;
-    float motCurrent;   //motor current read from readCurrent() function
+    float motI;   //motor current read from readCurrent() function
+    volatile float motI_last;
     float mot_I_lim;    //max current limit
+    float dIdT;
+    float mot_I_max, mot_I_max_last;
     int axisState;
     int motInvert;
     char dataFormat;    //'r'=radians (default), 'd'=degrees, 'e'=encoder counts