Andrew Bell
/
lab3
not finished
Revision 0:332a7dedda99, committed 2021-02-10
- Comitter:
- andrewbw01
- Date:
- Wed Feb 10 15:32:38 2021 +0000
- Commit message:
- not finished yet
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 332a7dedda99 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 10 15:32:38 2021 +0000 @@ -0,0 +1,52 @@ +#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'); + } + + + + \ No newline at end of file
diff -r 000000000000 -r 332a7dedda99 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Feb 10 15:32:38 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file