Jump to content
43oh

[SOLVED] MSP430G2 Launchpad Keypad Problem


Recommended Posts

Hello,

I tried to use my MSP430G2553 launchpad with a keypad (https://www.sparkfun.com/products/8653) using

#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. 

Link to post
Share on other sites

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...