I tried to use my MSP430G2553 launchpad with a keypad using
- http://www.pjrc.com/teensy/td_libs_Keypad.html
- http://bildr.org/2011/05/arduino-keypad/
- http://www.instructables.com/id/Using-the-sparkfun-12-Button-keypad-with-the-ardu/
- http://www.ti.com/lit/an/slaa139/slaa139.pdf (i just tried schematic with Energia code)
- http://little-scale.blogspot.com/2011/10/how-to-connect-keypad-to-arduino-simple.html (prints blank lines in same row , buttons doesn't work except 2,5,8,0 and they print "y")
.
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
//byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
//byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
byte rowPins[ROWS] = { P1_5, P1_4, P1_3, P1_2 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { P1_0, P1_7, P1_6 };
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print("Serial test\n");
delay(100);
char key = keypad.getKey();
if (key != NO_KEY){
Serial.println(key);
}
}
None of them works, they only print "Serial test" and thats when i press RESET. I tried using latest keypad library from ARDUINO site or the libraries that in those tutorials.
Do i need a different way to wire up the keypad to launchpad or need a different library?