So guys as the title says, I've seen this project done a lot in the old days and I wanted to try that out on an old 49 keys keyboard that is laying down (CASIO TYPE)
Basically I'm not a pro in coding . But anyway I've got the board and followed the instructions as guided
1- Scanned the keyboard matrix and wrote it all down Pictures attached the ribbons are made by 15 wires and the matrix is 9*6 and here are some pictures
2- On this point I'm not sure of what I'm doing but i got the 15 wires connected in order to the Arduino Mega Digital Pins starting from 22
3- I've connected the board to the computer now to begin with the real stuff .... But as I said I'm so trashatic when it comes to coding, I've searched multiple forums related to this project and watched everyvideo on Youtube but came with nothing related to the Arduino Mega regarding the coding or the source
4- As I was searching hopefully to find some code, I found a post on an old forum right here and I've went through it all
5- By the time I've spent I was able to get the keyboard matrix coded 100%
Serial monitor get all the readings perfectly
``
#include <Keypad.h>
const byte ROWS = 7; //Seven rows
const byte COLS = 10; //Ten columns
char keys[7][10] = {
{1, 2, 3, 15, 14, 13, 12, 11, 10},
{4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{5, 5, 5, 5, 5, 5, 5, 5, 5, 0},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{7, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 0},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 0},
};
byte rowPins[ROWS] = {26, 28, 30, 32, 34, 36, 38 ,}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {A0, A1, A2, A3, A4, A5, A6, A7, A8,}; //connect to the column pinouts of the kpd
Keypad kpd = Keypad( makeKeymap(49), rowPins, colPins, ROWS, COLS );
unsigned long loopCount;
unsigned long startTime;
String msg;
void setup() {
Serial.begin(9600);
loopCount = 0;
startTime = millis();
msg = "";
}
void loop() {
loopCount++;
if ( (millis() - startTime) > 5000 ) {
Serial.print("Average loops per second = ");
Serial.println(loopCount / 5);
startTime = millis();
loopCount = 0;
}
// Fills kpd.key[49] array with up-to 10 active keys.
// Returns true if there are ANY active keys.
if (kpd.getKeys())
{
for (int i = 0; i < LIST_MAX; i++) // Scan the whole key list.
{
if ( kpd.key[i].stateChanged ) // Only find keys that have changed state.
{
switch (kpd.key[i].kstate) { // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
case PRESSED:
msg = " PRESSED.";
break;
case HOLD:
msg = " HOLD.";
break;
case RELEASED:
msg = " RELEASED.";
break;
case IDLE:
msg = " IDLE.";
}
Serial.print("Key ");
Serial.print(kpd.key[i].kchar);
Serial.println(msg);
}
}
}
} // End loop
6- Now the only thing I need is to get the midi working while I press a key because its not doing any sound (and this is the part where I'm asking for help)*********