4×4 membrane switch set up
I’m trying to wire a 4×4 membrane switch to be able to input a string of numbers. The problem is A.) don’t have a lot of experience in matlab, and B.) all of the code libraries and stuff I’ve found for the switch is all based in the arduino software. Does anyone have any idea on how I can transfer it over or write my own?
here is a example of the arduino library:
#include “Keypad.h”
const byte ROWS = 4; // number of rows
const byte COLS = 3; // number of columns
char keys[ROWS][COLS] = {
{‘1′,’2′,’3’},
{‘4′,’5′,’6’},
{‘7′,’8′,’9’},
{‘#’,’0′,’*’}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; // row pinouts of the keypad R1 = D8, R2 = D7, R3 = D6, R4 = D5
byte colPins[COLS] = {4, 3, 2}; // column pinouts of the keypad C1 = D4, C2 = D3, C3 = D2
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup()
{
Serial.begin(9600);
}
void loop()
{
char key = keypad.getKey();
if (key ~= NO_KEY)
Serial.println(key);
}I’m trying to wire a 4×4 membrane switch to be able to input a string of numbers. The problem is A.) don’t have a lot of experience in matlab, and B.) all of the code libraries and stuff I’ve found for the switch is all based in the arduino software. Does anyone have any idea on how I can transfer it over or write my own?
here is a example of the arduino library:
#include “Keypad.h”
const byte ROWS = 4; // number of rows
const byte COLS = 3; // number of columns
char keys[ROWS][COLS] = {
{‘1′,’2′,’3’},
{‘4′,’5′,’6’},
{‘7′,’8′,’9’},
{‘#’,’0′,’*’}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; // row pinouts of the keypad R1 = D8, R2 = D7, R3 = D6, R4 = D5
byte colPins[COLS] = {4, 3, 2}; // column pinouts of the keypad C1 = D4, C2 = D3, C3 = D2
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup()
{
Serial.begin(9600);
}
void loop()
{
char key = keypad.getKey();
if (key ~= NO_KEY)
Serial.println(key);
} I’m trying to wire a 4×4 membrane switch to be able to input a string of numbers. The problem is A.) don’t have a lot of experience in matlab, and B.) all of the code libraries and stuff I’ve found for the switch is all based in the arduino software. Does anyone have any idea on how I can transfer it over or write my own?
here is a example of the arduino library:
#include “Keypad.h”
const byte ROWS = 4; // number of rows
const byte COLS = 3; // number of columns
char keys[ROWS][COLS] = {
{‘1′,’2′,’3’},
{‘4′,’5′,’6’},
{‘7′,’8′,’9’},
{‘#’,’0′,’*’}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; // row pinouts of the keypad R1 = D8, R2 = D7, R3 = D6, R4 = D5
byte colPins[COLS] = {4, 3, 2}; // column pinouts of the keypad C1 = D4, C2 = D3, C3 = D2
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup()
{
Serial.begin(9600);
}
void loop()
{
char key = keypad.getKey();
if (key ~= NO_KEY)
Serial.println(key);
} keypad, membrane, button MATLAB Answers — New Questions