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
Diff: main.cpp
- Revision:
- 1:d69f57dcde02
- Parent:
- 0:6f4cd2c49f65
- Child:
- 2:07a3107e7664
--- a/main.cpp Wed Nov 25 22:13:26 2015 +0000 +++ b/main.cpp Thu Nov 26 17:31:59 2015 +0000 @@ -1,7 +1,7 @@ /* Uses the ESP8266 WiFi Chip to set up a WiFi Webserver used to control - the position of a motor using a PID controller. USE FIREFOX Web - Browser + the position or speed of a motor using a PID controller. USE FIREFOX + Web Browser NOTES: 1. Webpage Handling in this program is specific to a CUSTOM @@ -219,17 +219,17 @@ kd = clip(kd, 0.00, 999.99); #ifdef DEBUG - printf("User Entered: \ncontrol_mode: %i\nSetpoint: %7.2f\nKp: %6.2f\nKi: %6.2f\nKd: %6.2f\n", + printf("User Entered: \ncontrol_mode: %i\nSetpoint: %7.4f\nKp: %6.4f\nKi: %6.4f\nKd: %6.4f\n", control_mode, setpoint, kp, ki, kd); #endif pid.set_parameters(kp, ki, kd, Ts); // Updata PID params #ifdef DEBUG - printf("Updated to Kp: %1.2f Ki: %1.2f Kd: %1.2f Ts: %1.2f\r\n", + printf("Updated to Kp: %1.4f Ki: %1.4f Kd: %1.4f Ts: %1.4f\r\n", pid.getKp(), pid.getKi(), pid.getKd(), pid.getTs()); - printf("Setpoint: %1.2f\r\n", setpoint); - printf("Output: %1.2f\r\n", output); + printf("Setpoint: %1.4f\r\n", setpoint); + printf("Output: %1.4f\r\n", output); printf("\r\n*************END USER INPUT******************************\r\n"); #endif