Keypad that has 12 keys for input
Dependents: Input_Keypad MARISOL Final_Project
Revision 2:795c6863bbc2, committed 2015-03-12
- Comitter:
- anevil14
- Date:
- Thu Mar 12 17:45:35 2015 +0000
- Parent:
- 1:518bf8b4f3b3
- Commit message:
- 12 Input Keypad from Sparkfun
Changed in this revision
main.cpp | Show diff for this revision Revisions of this file |
diff -r 518bf8b4f3b3 -r 795c6863bbc2 main.cpp --- a/main.cpp Thu Mar 12 17:18:25 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -#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(); - //pc.printf("Hello World!\n"); - //led1 = !led1; - for (int i=0;i<keys.size();i++){ - pc.printf("\nValue: %d : ",keys[i]); - } - wait(.1); - /*int size = keys.size(); - if (size == 0 ){ - led1 = 0; led2 = 0; led3 = 0; led4 = 0; - } - if (size == 1 ){ - led1 = 0; led2 = 0; led3 = 0; led4 = 1; - } - if (size ==2 ){ - led1 = 0; led2 = 0; led3 = 1; led4= 0; - } - - if (size > 2){ - led1 = 1; - } - - led3 = !led3; - */ - } -}