Trying to debug

Dependencies:   mbed TextLCD keypad

Committer:
baet6458
Date:
Wed Jan 30 03:31:27 2019 +0000
Revision:
2:c25102764602
Parent:
1:c57c18e1ca87
Child:
3:59fc3838d34d
commenting update;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
reyno1jk 0:9b646298bdc9 1 #include "TextLCD.h"
reyno1jk 0:9b646298bdc9 2 #include "mbed.h"
reyno1jk 0:9b646298bdc9 3 #include "Keypad.h"
reyno1jk 0:9b646298bdc9 4 #include <string>
reyno1jk 0:9b646298bdc9 5 // Define your own keypad values
reyno1jk 0:9b646298bdc9 6 char Keytable[] = { '1', '2', '3', 'U', // r0 U = up
reyno1jk 0:9b646298bdc9 7 '4', '5', '6', 'D', // r1 D = down
reyno1jk 0:9b646298bdc9 8 '7', '8', '9', 'S', // r2 S = 2nd
reyno1jk 0:9b646298bdc9 9 'C', '0', ',', 'E' // r3 C = clear, E = enter
reyno1jk 0:9b646298bdc9 10 };
reyno1jk 0:9b646298bdc9 11 // c0 c1 c2 c3
baet6458 1:c57c18e1ca87 12
baet6458 1:c57c18e1ca87 13 //displayed menu items
baet6458 1:c57c18e1ca87 14 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"};
baet6458 1:c57c18e1ca87 15
baet6458 1:c57c18e1ca87 16 //key pressed holder
baet6458 1:c57c18e1ca87 17 char keyPressed[]={0,0};
baet6458 1:c57c18e1ca87 18 //track the key presed
baet6458 1:c57c18e1ca87 19 int keyTracker=0;
reyno1jk 0:9b646298bdc9 20
baet6458 1:c57c18e1ca87 21 //enter function
baet6458 1:c57c18e1ca87 22 void enterFunc(){
baet6458 1:c57c18e1ca87 23 //do something eventually
baet6458 1:c57c18e1ca87 24 }
reyno1jk 0:9b646298bdc9 25
baet6458 1:c57c18e1ca87 26
baet6458 1:c57c18e1ca87 27 uint32_t LCDUpdate(uint32_t index) {
baet6458 1:c57c18e1ca87 28 //if enter is pressed
baet6458 1:c57c18e1ca87 29 if(index==15){
baet6458 1:c57c18e1ca87 30 //call enter function
baet6458 1:c57c18e1ca87 31 enterFunc();
baet6458 1:c57c18e1ca87 32 }
baet6458 1:c57c18e1ca87 33
baet6458 2:c25102764602 34 //place to put keys that have been presesed
baet6458 1:c57c18e1ca87 35 keyPressed[keyTracker]=Keytable[index];
baet6458 1:c57c18e1ca87 36 keyTracker++;
baet6458 1:c57c18e1ca87 37
baet6458 1:c57c18e1ca87 38
baet6458 1:c57c18e1ca87 39 return 0;
reyno1jk 0:9b646298bdc9 40 }
reyno1jk 0:9b646298bdc9 41
baet6458 1:c57c18e1ca87 42
reyno1jk 0:9b646298bdc9 43 int main() {
reyno1jk 0:9b646298bdc9 44 // r0 r1 r2 r3 c0 c1 c2 c3
reyno1jk 0:9b646298bdc9 45 Keypad keypad(D0, D1, D2, D3, D10, D11, D12, D13);
baet6458 1:c57c18e1ca87 46 keypad.attach(&LCDUpdate);
baet6458 2:c25102764602 47 keypad.start();
reyno1jk 0:9b646298bdc9 48 while (1) {
reyno1jk 0:9b646298bdc9 49 }
baet6458 2:c25102764602 50
reyno1jk 0:9b646298bdc9 51 }