key table

Dependencies:   FPointer keypad mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  #include "keypad.h"
00003  
00004  Serial pc(USBTX, USBRX); 
00005 
00006   
00007   // Define your own keypad values
00008   char Keytable[] = { '1', '2', '3',
00009                       '4', '5', '6',
00010                       '7', '8', '9',
00011                       '*', '0', '#'
00012                     };
00013   
00014   uint32_t 
00015   cbAfterInput(uint32_t index) 
00016   {
00017       pc.printf("Code\n");
00018       pc.printf("Index:%d => Key:%c\n", index, Keytable[index]);
00019       return 0;
00020   }
00021   
00022   int main() 
00023   {
00024       pc.printf("Code\n");
00025       Keypad keypad(p25, p26, p27, p28, p21, p22, p23, p24);
00026       keypad.CallAfterInput(&cbAfterInput);
00027       keypad.Start();
00028   
00029       while (1) {
00030           wait_ms(100);
00031       }
00032   }