2
\$\begingroup\$

I tried to use my MSP430G2553 launchpad with a keypad 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?

\$\endgroup\$
  • \$\begingroup\$ Consider using the Energia tag if that is the IDE you are using. Developing for Energia is slightly different than for the TI IDE based on Eclipse. \$\endgroup\$ – jippie Dec 8 '13 at 16:59
2
\$\begingroup\$

P1_2 is the RX pin for Serial.Since you call Serial after you instantiate the Keypad things will get messed up.

Source

Using another pin instead of that fixes the problem.

\$\endgroup\$
-2
\$\begingroup\$
#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("Full Version test /b/ script a test\n");
    delay(100); 
  char key = keypad.getKey();

  if (key != NO_KEY){
    Serial.println(key);
  }

Copy this and you'll get the full version for the EDM that you are using. or just download the one for the time expander. works for x32 versions of windows and above and do not use it for macintosh computers cause it is not compatible.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.