Hi guys,
I don't really have code to show for my project yet. I have a code base from a MIDIkeyboard project I found that I've started to cannibalize. I'm not married to that piece of code because I don't know that it will do what I want.
This 2D array assigns the character that is shown (its value) to a key. You can write to this array and change (assign) the value of a particular key any time. So for instance you want to have a 'X' where the '6' is. Since it is a char array, you can only assign one character per key.
Demo code:
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', '*'}
};
void setup()
{
Serial.begin(9600);
// print the existing array
for (int n = 0; n < COLS; n++)
{
for (int m = 0; m < ROWS; m++)
{
Serial.print(keys[n][m]);
Serial.print(" ");
}
}
Serial.println();
// now replace the '6' with 'X'
keys[1][2] = 'X'; // replace element row 1, column 2 with 'X'
// print the modified array
for (int n = 0; n < COLS; n++)
{
for (int m = 0; m < ROWS; m++)
{
Serial.print(keys[n][m]);
Serial.print(" ");
}
}
Serial.println();
}
void loop()
{
}
Actually, I hadn't read the code till now. Basically, I am making a USB controller. I want to be able to change the keys from the computer to the inputs of a game.
I guess I would have to write a driver or something?
This project might be more than I can chew for a first project..
The picture that shows your wiring does not show in my browser (Chrome). Here is a guide for posting images.
I don't really understand what you are trying to do. The schematic will help but can you describe your project in more detail?