Andrew Neville
/
Input_Keypad
Sparkfun 12 input keypad that hooks up and is built in a 4X3 matrix form.
Revision 0:c048d53baac8, committed 2015-03-12
- Comitter:
- anevil14
- Date:
- Thu Mar 12 18:14:49 2015 +0000
- Commit message:
- Keypad with main example code. 12 input keypad
Changed in this revision
diff -r 000000000000 -r c048d53baac8 KeyPad.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KeyPad.lib Thu Mar 12 18:14:49 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/anevil14/code/KeyPad/#795c6863bbc2
diff -r 000000000000 -r c048d53baac8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 12 18:14:49 2015 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" +#include "KeyPad.h" + +/* DigitalOut columnoneout ( p25 ); // pin 3 on keypad + DigitalOut columntwoout ( p27 ); // pin 1 on keypad + DigitalOut columnthreeout ( p23 ); // pin 5 on keypad + + DigitalIn rowonein ( p26 ); // pin 2 on keypad + DigitalIn rowtwoin ( p21 ); // pin 7 on keypad + DigitalIn rowthreein ( p22 ); // pin 6 on keypad + DigitalIn rowfourin ( p24 ); // pin 4 on keypard */ + +#include <iostream> +int main() { + Serial pc(USBTX, USBRX); // tx, rx + KeyPad2 keypad(p25, p27, p23, p26, p21, p22, p24); + DigitalOut led1(LED1); + DigitalOut led2(LED2); + DigitalOut led3(LED3); + DigitalOut led4(LED4); + led1 = 0; led2 = 0; led3 = 0; led4= 0; + pc.printf("starting to print\n"); + while(1) { + std::vector<int> keys = keypad.getkey(); + for (int i=0;i<keys.size();i++){ + pc.printf("\nValue: %d : ",keys[i]); + + } + wait(.1); + } +}
diff -r 000000000000 -r c048d53baac8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 12 18:14:49 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf \ No newline at end of file