![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
PID for ramp temperature control using LM35 temperature sensor and two actuators, a bulb and a ventilator.
Dependencies: DebouncedIn QEI TextLCD_encoder mbed
Fork of PID_Encoder by
Diff: main.cpp
- Revision:
- 1:ffbcc55fa659
- Parent:
- 0:8d2bbee60422
- Child:
- 2:fa1d90037a6c
--- a/main.cpp Sat Nov 09 18:09:11 2013 +0000 +++ b/main.cpp Sun Nov 10 05:50:46 2013 +0000 @@ -195,6 +195,7 @@ } ad = kd*(err-err_v); //calculo de la accion derivativa + pid = (ap+ai+ad); // se actualizan las variables ******************************************* @@ -204,6 +205,7 @@ if(pid<=0){ pid=0; } + // se verifica que pid sea menor o igual la valor maximo ***************** if (pid > 999){ pid=999; @@ -214,22 +216,14 @@ //se muestran las variables****************************************** - wait(0.3); - lcd.locate(2,0); - lcd.printf(" "); + wait(2); lcd.locate(2,0); lcd.printf("%d",err); lcd.locate(10,0); - lcd.printf(" "); - lcd.locate(10,0); lcd.printf("%d",med); lcd.locate(2,1); - lcd.printf(" "); - lcd.locate(2,1); lcd.printf("%d",sp); lcd.locate(10,1); - lcd.printf(" "); - lcd.locate(10,1); lcd.printf("%d",pid); @@ -239,7 +233,5 @@ u.write(pidn); // se repite el ciclo } - - - + }