a
Dependencies: mbed TextLCD Keypad
Revision 0:0b651cdc4e79, committed 2020-08-24
- Comitter:
- 20172573073
- Date:
- Mon Aug 24 23:03:18 2020 +0000
- Commit message:
- a
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keypad.lib Mon Aug 24 23:03:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/grantphillips/code/Keypad/#4bbd88022a6f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Mon Aug 24 23:03:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Aug 24 23:03:18 2020 +0000 @@ -0,0 +1,144 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "Keypad.h" +Keypad kpad(PTC4, PTC0, PTB19, PTB18, PTC11, PTC10, PTC7, PTC6); +TextLCD lcd(D0,D1,D2,D3,D4,D5, TextLCD::LCD16x2 ); + +char key ; +int x =0; +int y =0; +int i,j,k; +Ticker teclado; +void tec() +{ + key = kpad.ReadKey(); +} +void keysito() +{ + switch(key) { + case '1': + lcd.printf("1"); + x=1; + y=y+1; + break; + + case '2': + lcd.printf("2"); + x=2; + y=y+1; + break; + + case '3': + lcd.printf("3"); + x=3; + y=y+1; + break; + case '4': + lcd.printf("4"); + x=4; + y=y+1; + break; + + case '5': + lcd.printf("5"); + x=5; + y=y+1; + break; + + case '6': + lcd.printf("6"); + x=6; + y=y+1; + break; + case '7': + lcd.printf("7"); + x=7; + y=y+1; + break; + + case '8': + lcd.printf("8"); + x=8; + y=y+1; + break; + + case '9': + lcd.printf("9"); + x=0; + y=y+1; + break; + + case '0': + lcd.printf("0"); + x=0; + y=y+1; + break; + + + } + + wait(0.5); + +} +void filas() +{ + lcd.locate(0,0); + lcd.printf("# filas < 16"); + lcd.locate(0,1); + keysito(); + +} + +void columnas() +{ + lcd.locate(0,0); + lcd.printf("# columnas < 2"); + lcd.locate(0,1); + keysito(); +} +void asterisco() +{ + lcd.locate(0,0); + lcd.printf("# asteriscos"); + lcd.locate(0,1); + keysito(); +} +int main () +{ + + //teclado.attach(&tec,0.01); + + while(1) { + tec(); + if(y == 0) { + lcd.cls(); + filas(); + i=x; + x=0; + wait(1.5); + }tec(); + if(y == 1) { + lcd.cls(); + columnas(); + j=x; + x=0; + wait(1.5); + }tec(); + if(y == 2) { + lcd.cls(); + asterisco(); + k=x; + x=0; + wait(1.5); + if( y > 2){ + lcd.cls(); + lcd.locate(i,j); + int a=1; + while(k >= a){ + lcd.printf("*"); + a=a+1; + } + } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Aug 24 23:03:18 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file