Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DebouncedIn TextLCD mbed
Fork of PID_Encoder by
Revision 1:ffbcc55fa659, committed 2013-11-10
- Comitter:
- lcorralesc1
- Date:
- Sun Nov 10 05:50:46 2013 +0000
- Parent:
- 0:8d2bbee60422
- Child:
- 2:fa1d90037a6c
- Commit message:
- Controlador PID con lectura mediante encoder
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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
}
-
-
-
+
}
