TAREA 1 PROCESADORES
Dependencies: Debounced TextLCD1 mbed
Revision 0:4bbed673452c, committed 2013-11-18
- Comitter:
- caaruizze
- Date:
- Mon Nov 18 01:44:07 2013 +0000
- Commit message:
- TAREA 1 ESCRITURA PARAMETROS lEN UN LCD
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Debounced.lib Mon Nov 18 01:44:07 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD1.lib Mon Nov 18 01:44:07 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/caaruizze/code/TextLCD1/#32640818bc85
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Nov 18 01:44:07 2013 +0000 @@ -0,0 +1,130 @@ +#include "mbed.h" +#include "DebouncedIn.h" +#include "TextLCD1.h" +int C1=0x0e; +int i,k,j,n; +int x=1; +int px=3,py=0; +int B1,B2; + +int main() { +TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5) ;// declaración de los puertos del lcd +DebouncedIn b1(PTC16); //cambio de posición +DebouncedIn b2(PTC13);// aumento, +DebouncedIn b3(PTC12);// disminuye +lcd.printf("TAREA1:Proc"); // IMPRIMIR +wait(1); // espera 1 segundo +lcd.cls(); // borra lcd +lcd.writeCommand(C1); // escribe el comando C1 + // Localiza y escribe los titulos Sp,Kp,Ki,Kd en la patalla +lcd.locate(0,0); +lcd.printf("Sp:%d", b1.read()); +lcd.locate(8,0); +lcd.printf("Kp:%d",b1.read()); +lcd.locate(0,1); +lcd.printf("Ki:%d",b1.read()); +lcd.locate(8,1); +lcd.printf("Kd:%d",b1.read()); + // Ciclo infinito +while (1) +{ +if(b2.falling()){ + x=x+1; + +} +//condicionales para ubicación en pantalla +if(x==1){ + px=3; + py=0; + +} +if(x==2) +{ + px=11; + py=0; +} + +if(x==3){ + px=3; + py=1; +} +if(x==4){ + px=11; + py=1; +} +if(x>4){ + //px=0; + //py=0; + x=1; +} +//condicional para contador ascendente y imprimir + +if(px==3 && py==0){ +if(b1.falling()){ +i=i+1; +} +if(b3.falling()){ +i=i-1; +} +if(i<0){ +i=0; +} +lcd.locate(px,py); +lcd.printf("%d",i); + +} + +if(px==11 && py==0){ +if(b1.falling()){ +k=k+1; +} +if(b3.falling()){ +k=k-1; +} +if(k<0){ +k=0; +} +lcd.locate(px,py); +lcd.printf("%d",k); +} + +if(px==3 && py==1){ +if(b1.falling()){ +j=j+1; +} +if(b3.falling()){ +j=j-1; +} +if(j<0){ +j=0; +} +lcd.locate(px,py); +lcd.printf("%d",j); +} +if(px==11 && py==1){ +if(b1.falling()){ +n=n+1; +} +if(b3.falling()){ +n=n-1; +} +if(n<0){ +n=0; +} +lcd.locate(px,py); +lcd.printf("%d",n); +} +//localizar en px,py y imprimir el valor de i +//lcd.locate(px,py); +//lcd.printf("%d",i); +/* +if(px==3 && py==0){ + +}*/ + +} +} + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Nov 18 01:44:07 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file