Hello, through the steps indicated by Grumpy_Mike, I managed to make my old CASIO CTK 485 come back to life as a controller. The step by step I followed is here.
After this feat, a friend became interested in the project, as he also had a defective keyboard.
We followed the same steps as my CASIO post and were able to map the key matrix. The difference was that we came across a combination, where 12 + 11 (23) wires generate two 6x11 arrays, where there are two possibilities of connections to activate the same key. There is also a discounted ribbon below the keyboard.
I believe this is related to the sensitivity of the keys.
At this point the doubts started, analyzing the code used in my CASIO I don't know how to introduce this second matrix to activate the sensitivity of the keys.
Another question that arose was how to add a sustain pedal to the code.
I am currently using this code with the Arduino mega 2560, but with 6 wires, there is no touch sensitivity and no sustain.
The full code is here.
#include <MIDI.h>
#include <Keypad.h>
const byte ROWS = 6; // 6 Linhas
const byte COLS = 11; // 11 Colunas
char keys[ROWS][COLS] = {
{36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96},
{37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97},
{38, 44, 50, 56, 62, 68, 74, 80, 86, 92, 98},
{39, 45, 51, 57, 63, 69, 75, 81, 87, 93, 99},
{40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100},
{41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101}
};
byte rowPins[ROWS] = {22, 26, 30, 34, 38, 42}; //conectar-se às pinagens de linha do teclado
byte colPins[COLS] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10}; //conectar-se às pinagens das colunas do teclado
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
byte pressed = 32;
byte chanel = 0; // Canal MIDI para usar
void setup() {
Serial.begin(115200); // definir isso o mesmo que no Hairless
}
void loop() {
// 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.
{
pressed = kpd.key[i].kchar + 12;
switch (kpd.key[i].kstate) { // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
case PRESSED:
sendMIDI(chanel | 0x90, pressed, 100);
break;
case RELEASED:
sendMIDI(chanel | 0x80, pressed, 64);
break;
}
}
}
}
} // End loop
void sendMIDI(byte type, byte note, byte velocity){
Serial.write(type);
Serial.write(note & 0x7F);
Serial.write(velocity);
}
I appreciate anyone who can help.