PID Motor Speed & Position Control Over WiFi using ESP8266 WiFi module, US Digital E4P-100-079 Quadrature Encoder, HN-GH12-1634T 30:1 200 RPM DC Motor, and LMD18200 H-Bridge Breakout

Dependencies:   4DGL-uLCD-SE PID QEI SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
electromotivated
Date:
Sat Nov 28 03:16:31 2015 +0000
Parent:
3:7fb9c4c7e24b
Commit message:
Added comments;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7fb9c4c7e24b -r 9f51c7de9ebd main.cpp
--- a/main.cpp	Fri Nov 27 21:01:43 2015 +0000
+++ b/main.cpp	Sat Nov 28 03:16:31 2015 +0000
@@ -216,10 +216,10 @@
                     #endif
                     
                     parse_input(buff, &control_mode, &setpoint, &kp, &ki, &kd);
-                    setpoint = clip(setpoint, -999.99, 999.99);
-                    kp = clip(kp, 0.00, 999.99); 
-                    ki = clip(ki, 0.00, 999.99); 
-                    kd = clip(kd, 0.00, 999.99);
+                    setpoint = clip(setpoint, -999.99, 999.99); // -999.99 is max size that can be updated to webpage, i.e. field is 7 digits (see html)
+                    kp = clip(kp, 0.00, 999.99); // 999.99 is max size that can be updated to webpage, i.e. field is 6 digits (see html)
+                    ki = clip(ki, 0.00, 999.99); // 999.99 is max size that can be updated to webpage, i.e. field is 6 digits (see html)
+                    kd = clip(kd, 0.00, 999.99); // 999.99 is max size that can be updated to webpage, i.e. field is 6 digits (see html)
                     
                     #ifdef DEBUG
                     printf("User Entered: \ncontrol_mode: %i\nSetpoint: %7.4f\nKp: %6.4f\nKi: %6.4f\nKd: %6.4f\n",