Sergio Londono
/
Tarea2
es un programa de incremento de una variable al undir un boton
Revision 0:e968f2e6d440, committed 2013-10-16
- Comitter:
- salondonog
- Date:
- Wed Oct 16 06:46:07 2013 +0000
- Commit message:
- tarea 2
Changed in this revision
diff -r 000000000000 -r e968f2e6d440 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed Oct 16 06:46:07 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/salondonog/code/TextLCD/#e6111e52dd59
diff -r 000000000000 -r e968f2e6d440 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 16 06:46:07 2013 +0000 @@ -0,0 +1,87 @@ +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); //configura los puestos PTE0,PTE1,PTE2,PTE3,PTE4,PTE5, donde se conectara el LCD 16x2 +DigitalIn b1(PTC16); +int C1=0x0E; +int k=0; +int b=0; +int incremento=0; + + +int main() { + +lcd.printf("contador \n"); +lcd.writeCommand(C1); +lcd.locate(0,1); lcd.printf(" "); +while(1){ +if(!b1.read() && incremento>=10000){ +incremento=0; +lcd.locate(0,1); lcd.printf("%d ",incremento); +wait(0.25); +} +while (1){ +if(incremento==10000){ +break; +} +else if(!b1.read()){ + for(k=0;k<20;k++){ + if(b1.read()){ + break; + } + if(incremento>9999){ + incremento=10000; + lcd.locate(0,1); lcd.printf("%d ",incremento); + break; + } + incremento++; + lcd.locate(0,1); lcd.printf("%d ",incremento); + wait(0.25); + } + + for(k=0;k<20;k++){ + if(b1.read()){ + break; + } + if(incremento>9999){ + incremento=10000; + lcd.locate(0,1); lcd.printf("%d ",incremento); + break; + } + incremento+=10; + lcd.locate(0,1); lcd.printf("%d ",incremento); + wait(0.25); + } + for(k=0;k<20;k++){ + if(b1.read()){ + break; + } + if(incremento>9999){ + incremento=10000; + lcd.locate(0,1); lcd.printf("%d ",incremento); + break; + } + incremento+=100; + lcd.locate(0,1); lcd.printf("%d ",incremento); + wait(0.25); + } + + while(1){ + if(b1.read()){ + break; + } + if(incremento>9999){ + incremento=10000; + lcd.locate(0,1); lcd.printf("%d ",incremento); + break; + } + incremento+=1000; + lcd.locate(0,1); lcd.printf("%d ",incremento); + wait(0.25); + } + } + } + } + } + +
diff -r 000000000000 -r e968f2e6d440 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 16 06:46:07 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file