Incrementar por medio de pulsadores
Dependencies: Debounced TextLCD mbed
Revision 0:7ac8f5f3e58b, committed 2013-12-13
- Comitter:
- ikortegag
- Date:
- Fri Dec 13 17:31:13 2013 +0000
- Commit message:
- Incrementar por medio de pulsadores
Changed in this revision
diff -r 000000000000 -r 7ac8f5f3e58b Debounced.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Debounced.lib Fri Dec 13 17:31:13 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b
diff -r 000000000000 -r 7ac8f5f3e58b TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Fri Dec 13 17:31:13 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/ikortegag/code/TextLCD/#0c9d76d82120
diff -r 000000000000 -r 7ac8f5f3e58b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 13 17:31:13 2013 +0000 @@ -0,0 +1,118 @@ +#include "mbed.h" +#include "DebouncedIn.h" +#include "TextLCD.h" + +AnalogIn Vin(PTC2); +TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 +DigitalOut l1(LED1); +DigitalOut l2(LED2); +DebouncedIn b1(PTC12); +DebouncedIn b2(PTC13); +DebouncedIn b3(PTA1); +int c1=0x0E,i,k=1; + +int main() +{ + while(k==1) { + lcd.cls(); + lcd.writeCommand(c1); + lcd.locate(0,0); + lcd.printf("SP= %d",i); + lcd.locate(11,0); + lcd.printf("KP= %d",i); + lcd.locate(0,1); + lcd.printf("Ki= %d",i); + lcd.locate(11,1); + lcd.printf("Kd= %d",i); + + while(k==1) { + + if(b1.falling()) { + l1 = !l1; + ++i; + lcd.locate(3,0); + lcd.printf("%d",i); + } + if (b2.falling() && i>=1) { + l2 = !l2; + --i; + lcd.locate(3,0); + lcd.printf("%d",i); + } + if (b3.falling()) { + k+=1; + i=0; + } + + } + + + while(k==2) { + + if(b1.falling()) { + l1 = !l1; + ++i; + lcd.locate(14,0); + lcd.printf("%d",i); + } + if (b2.falling() && i>=1) { + l2 = !l2; + --i; + lcd.locate(14,0); + lcd.printf("%d",i); + } + if (b3.falling()) { + k+=1; + i=0; + } + + } + + + while(k==3) { + + if(b1.falling()) { + l1 = !l1; + ++i; + lcd.locate(3,1); + lcd.printf("%d",i); + } + if (b2.falling() && i>=1) { + l2 = !l2; + --i; + lcd.locate(3,1); + lcd.printf("%d",i); + } + if (b3.falling()) { + k+=1; + i=0; + } + + } + + + while(k==4) { + + if(b1.falling()) { + l1 = !l1; + ++i; + lcd.locate(14,1); + lcd.printf("%d",i); + } + if (b2.falling() && i>=1) { + l2 = !l2; + --i; + lcd.locate(14,1); + lcd.printf("%d",i); + } + if (b3.falling()) { + k=1; + i=0; + } + continue; + } + + } + +} +
diff -r 000000000000 -r 7ac8f5f3e58b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 13 17:31:13 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file