
Ninguna
Revision 0:a593c1db97bb, committed 2013-10-17
- Comitter:
- fvelasquezv
- Date:
- Thu Oct 17 21:58:14 2013 +0000
- Commit message:
- Rampa de subida y bajada de un dato en LCD
Changed in this revision
diff -r 000000000000 -r a593c1db97bb Debounced.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Debounced.lib Thu Oct 17 21:58:14 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b
diff -r 000000000000 -r a593c1db97bb TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Oct 17 21:58:14 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r a593c1db97bb main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 17 21:58:14 2013 +0000 @@ -0,0 +1,104 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "DebouncedIn.h" + +Timer timer1; +TextLCD lcd(PTC10, PTC11, PTC12, PTC13, PTC16, PTC17); // rs, e, d4-d7TextLCD lcd(PTC10, PTC11, PTC12, PTC13, PTC16, PTC17); // rs, e, d4-d7 +DebouncedIn Arriba(PTE2); +DebouncedIn Abajo(PTE3); +DigitalOut myled(LED1); + +int i; + +int main() { + + lcd.cls(); + lcd.printf("Conteo:%d", i); + + while(1){ + + + if(Arriba.falling()||Abajo.falling()){ + timer1.start(); + } + while(Arriba==0||Abajo==0){ + if(Arriba==1&&Abajo==1){ + timer1.stop(); + timer1.reset(); + + } + if (timer1.read()>0&&timer1.read()<=5&&Arriba==0&&i>=0&&i<=1000) { + ++i; + myled=1; + wait(0.3); + myled=0; + wait(0.3); + + } + if (timer1.read()>0&&timer1.read()<=5&&Abajo==0&&i>=0&&i<=1000) { + --i; + myled=1; + wait(0.3); + myled=0; + wait(0.3); + + } + + if (timer1.read()>5&&timer1.read()<=10&&Arriba==0&&i>=0&&i<=1000) { + i+=5; + myled=1; + wait(0.3/5); + myled=0; + wait(0.3/5); + + } + if (timer1.read()>5&&timer1.read()<=10&&Abajo==0&&i>=0&&i<=1000) { + i-=5; + myled=1; + wait(0.3/5); + myled=0; + wait(0.3/5); + + } + + + if (timer1.read()>10&&timer1.read()<=100&&Arriba==0&&i>=0&&i<=1000) { + i+=10; + + myled=1; + wait(0.03); + myled=0; + wait(0.03); + + } + if (timer1.read()>10&&timer1.read()<=100&&Abajo==0&&i>=0&&i<=1000) { + i-=10; + + myled=1; + wait(0.03); + myled=0; + wait(0.03); + + } + if(i<0){ + i=0; + } + + if(i>1000){ + i=1000; + } + i=i; + lcd.locate(7,0); + lcd.printf(" "); + lcd.locate(8,0); + lcd.printf("%d", i); + wait(0.2); + + + } + } + } + + + +
diff -r 000000000000 -r a593c1db97bb mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 17 21:58:14 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file