keypad kullanimi

Dependencies:   mbed TextLCD keypad

main.cpp

Committer:
marvas
Date:
2019-12-04
Revision:
0:81aa7be5b5cb

File content as of revision 0:81aa7be5b5cb:

#include "mbed.h"
#include "TextLCD.h"
#include "Keypad.h"
TextLCD lcd(PB_0,PA_4,PC_3,PC_2,PB_3,PA_10);

 
  // Define your own keypad values
  char Keytable[] = { '1', '2', '3', 'A',   // r0
                      '4', '5', '6', 'B',   // r1
                      '7', '8', '9', 'C',   // r2
                      '*', '0', '#', 'D'    // r3
                    };
                   // c0   c1   c2   c3
 
  uint32_t Index;
 
  uint32_t cbAfterInput(uint32_t index) {
      Index = index;
               lcd.cls();
          lcd.printf("Basilan Tus:%c",Keytable[Index]);
      return 0;
  }
 
  int main() {
                  // r0   r1   r2   r3   c0   c1   c2   c3
      Keypad keypad(PC_12, PC_10, PC_11,PD_2,PA_13,PA_14,PA_15,PC_8);
      keypad.attach(&cbAfterInput);
      keypad.start();  // energize the keypad via c0-c3
 
      while (1) {
          //__wfi();
wait(100);
      }
  }