PID Motor Position Control using ESP8266 WiFi Module, US Digital E4P-100-079, LMD18200 H-Bridge Break Out, and HN-GH12-1634T 30:1 200RPM Motor
Dependencies: 4DGL-uLCD-SE PID QEI SDFileSystem mbed ESP8266_pid_mtrPos_webserver_SDcard_v2
Dependents: ESP8266_pid_mtrPos_webserver_SDcard_v2
Revision 10:10e747c23f6f, committed 2015-11-28
- Comitter:
- electromotivated
- Date:
- Sat Nov 28 03:15:18 2015 +0000
- Parent:
- 9:ea167d8bdb4c
- Commit message:
- Added comments;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ea167d8bdb4c -r 10e747c23f6f main.cpp --- a/main.cpp Fri Nov 27 15:26:42 2015 +0000 +++ b/main.cpp Sat Nov 28 03:15:18 2015 +0000 @@ -213,10 +213,10 @@ */ // printf("\r\n*************USER INPUT**********************************\r\n"); parse_input(buff, &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) // printf("User Entered: \nSetpoint: %7.2f\nKp: %6.2f\nKi: %6.2f\nKd: %6.2f\n", setpoint, kp, ki, kd); pid.set_parameters(kp, ki, kd, Ts_init); // Updata PID params // printf("Updated to Kp: %1.2f Ki: %1.2f Kd: %1.2f Ts: %1.2f\r\n",