prueba teclado matricial 4x3

Dependencies:   TextLCD mbed

Fork of LCD_test by proyectotecnicas

Committer:
Diegolorca
Date:
Mon Nov 30 03:49:51 2015 +0000
Revision:
1:85232e54cfcf
Parent:
0:a9f60dff8cb6
prueba de teclado matricial 4x3 usando interrupcion la salida se observa en el LCD externo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
josedaparte 0:a9f60dff8cb6 1 #include "mbed.h"
josedaparte 0:a9f60dff8cb6 2 #include "TextLCD.h"
Diegolorca 1:85232e54cfcf 3
Diegolorca 1:85232e54cfcf 4
Diegolorca 1:85232e54cfcf 5 TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2);
Diegolorca 1:85232e54cfcf 6
Diegolorca 1:85232e54cfcf 7 DigitalIn key1(PTC1);
Diegolorca 1:85232e54cfcf 8 DigitalIn key2(PTC2);
Diegolorca 1:85232e54cfcf 9 DigitalIn key3(PTB3);
Diegolorca 1:85232e54cfcf 10 DigitalIn key4(PTB2);
Diegolorca 1:85232e54cfcf 11 InterruptIn Enable(PTA2);
josedaparte 0:a9f60dff8cb6 12
Diegolorca 1:85232e54cfcf 13 int num, B1,B2,B3,B4;
josedaparte 0:a9f60dff8cb6 14
Diegolorca 1:85232e54cfcf 15 void func()
Diegolorca 1:85232e54cfcf 16 {
Diegolorca 1:85232e54cfcf 17 lcd.cls();
Diegolorca 1:85232e54cfcf 18 lcd.printf(" %d ", num);
Diegolorca 1:85232e54cfcf 19 wait(1);
Diegolorca 1:85232e54cfcf 20 lcd.cls();
Diegolorca 1:85232e54cfcf 21 }
Diegolorca 1:85232e54cfcf 22
josedaparte 0:a9f60dff8cb6 23 int main() {
josedaparte 0:a9f60dff8cb6 24
Diegolorca 1:85232e54cfcf 25 while(1)
Diegolorca 1:85232e54cfcf 26 {
josedaparte 0:a9f60dff8cb6 27
Diegolorca 1:85232e54cfcf 28 B1 = key1.read();
Diegolorca 1:85232e54cfcf 29 B2 = key2.read();
Diegolorca 1:85232e54cfcf 30 B3 = key3.read();
Diegolorca 1:85232e54cfcf 31 B4 = key4.read();
josedaparte 0:a9f60dff8cb6 32
Diegolorca 1:85232e54cfcf 33 num = 2*2*2*B1 + 2*2*B2 + 2*B3 + B4;
josedaparte 0:a9f60dff8cb6 34
Diegolorca 1:85232e54cfcf 35 Enable.rise(&func);
josedaparte 0:a9f60dff8cb6 36 }
josedaparte 0:a9f60dff8cb6 37 }