[simpits-tech] 32 channel input matrix board..
geneb
geneb at deltasoft.com
Mon May 19 13:20:10 PDT 2014
Here you go!
http://www.geneb.org/projects/input/32ch-board-gerbers.zip
http://www.geneb.org/projects/input/32ch-board.zip
http://www.geneb.org/projects/input/32ch-board.bmp
The board design tested out and it works great. You can use 1N4148 diodes
in it.
Here's some demo code that will work with it - You need to tweak the
LIST_MAX field in the Keypad library if you're going to use big input
matrices.
// This example only uses a small 3x2 matrix. A standard Arduino Uno should
// be able to work with up to an 8 by 10 matrix.
#if LIST_MAX != 128
#error You need to modify the LIST_MAX constant in Keypad.h to be 128.
#error LIST_MAX
#endif
const byte ROWS = 3; // three rows const byte
COLS = 2; // two columns
byte switches[ROWS][COLS];
byte rowPins[ROWS] = {4, 3, 2}; //connect to the row pinouts of the input matrix
byte colPins[COLS] = {7, 6}; //connect to the column pinouts of the input matrix
Keypad keypad = Keypad( makeKeymap(switches), rowPins, colPins, ROWS, COLS );
String msg = "";
void setup(){
byte row;
byte col;
byte switch_num = 1;
Serial.begin(9600);
keypad = Keypad( makeKeymap(switches), rowPins, colPins, ROWS, COLS );
keypad.setDebounceTime(1);
Serial.print("LIST_MAX is ");
Serial.println(LIST_MAX, DEC);
for(row = 0; row < ROWS; row++) {
for(col = 0; col < COLS; col++) {
switches[row][col] = switch_num;
switch_num++;
}
}
Serial.println("Ready.");
} void loop(){
if (keypad.getKeys()) {
for(int i = 0; i < LIST_MAX; i++) {
if (keypad.key[i].stateChanged) {
switch (keypad.key[i].kstate) {
case PRESSED:
msg = " On.";
break;
case HOLD:
case IDLE:
msg = "";
break;
case RELEASED:
msg = " Off.";
break;
}
if (!msg.equals("")) {
Serial.print("Switch ");
Serial.print(keypad.key[i].kchar, DEC);
Serial.println(msg);
}
}
}
}
}
More information about the Simpits-tech
mailing list