Traté de usar mi plataforma de lanzamiento MSP430G2553 con un teclado usando
.
#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);
}
}
Ninguno de ellos funciona, solo imprimen "Prueba en serie" y ahí es cuando presiono RESET. Intenté usar la última biblioteca de teclado del sitio ARDUINO o las bibliotecas que se encuentran en esos tutoriales.
¿Necesito una forma diferente de conectar el teclado a la plataforma de lanzamiento o necesito una biblioteca diferente?
P1_2 es el pin RX para Serial. Dado que llama a Serial después de instanciar el teclado, las cosas se estropearán.
Usar otro pin en lugar de eso soluciona el problema.
#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);
}
Copie esto y obtendrá la versión completa para el EDM que está utilizando. o simplemente descargue el del expansor de tiempo. funciona para versiones x32 de Windows y superiores y no lo use para computadoras Macintosh porque no es compatible.
yippie