Andrew Bell
/
lab3
not finished
main.cpp
- Committer:
- andrewbw01
- Date:
- 2021-02-10
- Revision:
- 0:332a7dedda99
File content as of revision 0:332a7dedda99:
#include "mbed.h" BusOut LED_Disp(p7,p11,p9,p8,p5,p6,p10,p12); DigitalOut test(LED1); DigitalOut col1 (p26); // pin 4 on keypad DigitalOut col2 (p28); // pin 2 DigitalOut col3 (p24); // pin 6 DigitalIn row1 (p27); // pin 3 DigitalIn row2 (p22); // pin 8 DigitalIn row3 (p23); // pin 7 DigitalIn row4 (p25); // pin 5 char keypad(void) { col1 = 1; //test keys presson on col1 col2 = 0; col3 = 0; if (row1==1) { while(row1==1){} col1 = 0; // pull all back to 0 col2 = 0; col3 = 0; return('1'); // return char 1 } else if (row2==1) // row2 = 1 { while (row2==1){} col1 = 0; col2 = 0; col3 = 0; return('4'); // return 4 } else if (row3==1) // row3 = 1 { while (row3==1){} col1 = 0; col2 = 0; col3 = 0; return('7'); }