Trying to debug
Dependencies: mbed TextLCD keypad
keypadandlc.cpp
- Committer:
- baet6458
- Date:
- 2019-01-30
- Revision:
- 2:c25102764602
- Parent:
- 1:c57c18e1ca87
- Child:
- 3:59fc3838d34d
File content as of revision 2:c25102764602:
#include "TextLCD.h" #include "mbed.h" #include "Keypad.h" #include <string> // Define your own keypad values char Keytable[] = { '1', '2', '3', 'U', // r0 U = up '4', '5', '6', 'D', // r1 D = down '7', '8', '9', 'S', // r2 S = 2nd 'C', '0', ',', 'E' // r3 C = clear, E = enter }; // c0 c1 c2 c3 //displayed menu items const char* menu[]={"Select harness:","1. Harness A","2. Harness B","3. Harness C","4. Harness D","5. Harness E","6. Harness F","7. Harness G","8. Harness H","9. Harness I","Test in progress"}; //key pressed holder char keyPressed[]={0,0}; //track the key presed int keyTracker=0; //enter function void enterFunc(){ //do something eventually } uint32_t LCDUpdate(uint32_t index) { //if enter is pressed if(index==15){ //call enter function enterFunc(); } //place to put keys that have been presesed keyPressed[keyTracker]=Keytable[index]; keyTracker++; return 0; } int main() { // r0 r1 r2 r3 c0 c1 c2 c3 Keypad keypad(D0, D1, D2, D3, D10, D11, D12, D13); keypad.attach(&LCDUpdate); keypad.start(); while (1) { } }