cagurtay 1 Posted December 8, 2013 Share Posted December 8, 2013 Hello, I tried to use my MSP430G2553 launchpad with a keypad (https://www.sparkfun.com/products/8653) 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? Thank you. Quote Link to post Share on other sites
energia 485 Posted December 8, 2013 Share Posted December 8, 2013 Be careful which pins you use. P1_2 is the RX pin for Serial. Since you call Serial after you instantiate the Keypad things will get messed up and could be the reason why things don't work. I also read through the Keypad code from http://www.pjrc.com/teensy/td_libs_Keypad.html and see nothing in this code that would not work on MSP430. Of course the devil is in the details but at first glance this should just work. Try a different pin than P1_2. You can find the pin map for the MSP430G launchpad here: http://energia.nu/Guide_MSP430LaunchPad.html Robert cagurtay 1 Quote Link to post Share on other sites
cagurtay 1 Posted December 8, 2013 Author Share Posted December 8, 2013 Bah... Thank you. Quote Link to post Share on other sites
energia 485 Posted December 9, 2013 Share Posted December 9, 2013 Does that mean it works with a different pin? Quote Link to post Share on other sites
cagurtay 1 Posted December 9, 2013 Author Share Posted December 9, 2013 Yes, I switched P1_2 to P2_0 and it works but i need swap "*" and "#" in char keys[ROWS][COLS] because they are on different side on my keypad. energia 1 Quote Link to post Share on other sites
energia 485 Posted December 10, 2013 Share Posted December 10, 2013 Happy to hear you got it working! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.