proyectotecnicas
/
LCD_test_teclado
prueba teclado matricial 4x3
Fork of LCD_test by
Diff: main.cpp
- Revision:
- 1:85232e54cfcf
- Parent:
- 0:a9f60dff8cb6
--- a/main.cpp Thu Nov 26 21:18:11 2015 +0000 +++ b/main.cpp Mon Nov 30 03:49:51 2015 +0000 @@ -1,26 +1,37 @@ #include "mbed.h" #include "TextLCD.h" -#include "AnalogIn.h" + + +TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); + +DigitalIn key1(PTC1); +DigitalIn key2(PTC2); +DigitalIn key3(PTB3); +DigitalIn key4(PTB2); +InterruptIn Enable(PTA2); -AnalogIn leer(PTC1); +int num, B1,B2,B3,B4; -TextLCD lcd(PTE20, PTE21, PTE22, PTE23, PTB20, PTE30, TextLCD::LCD16x2); - +void func() +{ + lcd.cls(); + lcd.printf(" %d ", num); + wait(1); + lcd.cls(); +} + int main() { -float lectura; -float voltaje; - - while(1){ + while(1) + { - lectura = leer.read(); - voltaje = lectura*3.3; - lcd.cls(); - lcd.printf("%f",lectura); - lcd.locate(1,1); - lcd.printf("%f", voltaje); - wait(2); + B1 = key1.read(); + B2 = key2.read(); + B3 = key3.read(); + B4 = key4.read(); + num = 2*2*2*B1 + 2*2*B2 + 2*B3 + B4; + Enable.rise(&func); } }