Hi,
I am working on a keyboard matrix which will send either single keyboard presses (0-9 + symbols), keyboard commands and midi notes.
I started with the Adafruit Keypad library and now branched out from there.
Currently I am working on a 5 x 5 mock up board (this will be a lot bigger in the final project) and I have the code switching between sending a Keyboard.press() or a usbMIDI.sendNoteOn() based on the length of the variable returned from the array. All is good until it comes to sending keyboard commands! In the serial window I see the command printed however in PC software it doesn't work (I use Notepad++ to test in).
This is my array:
This is the output part of my code:
In the Serial window I will get for example: KEY_UP....etc
No response with the PC generally though. I am not sure how to convert "KEYS[colIndex][rowIndex]" into a format that Keyboard.press() can execute.
I can write an IF/SWITCH statement to compare the value of the array result and hard code the Keyboard.press line for each one but that will involve a lot of code.
Any ideas?
(I haven't included the full code as I don't feel it adds anything to the issue).
Matthew
I am working on a keyboard matrix which will send either single keyboard presses (0-9 + symbols), keyboard commands and midi notes.
I started with the Adafruit Keypad library and now branched out from there.
Currently I am working on a 5 x 5 mock up board (this will be a lot bigger in the final project) and I have the code switching between sending a Keyboard.press() or a usbMIDI.sendNoteOn() based on the length of the variable returned from the array. All is good until it comes to sending keyboard commands! In the serial window I see the command printed however in PC software it doesn't work (I use Notepad++ to test in).
This is my array:
Code:
const byte ROWS = 5; // four rows
const byte COLS = 5; // eight columns
char *KEYS[ROWS][COLS] = {
{"1", "2", "3", "KEY_UP", "100"},
{"4", "5", "6", "KEY_DOWN", "101"},
{"7", "8", "9", "KEY_LEFT", "102"},
{"10", "15", "20", "KEY_RIGHT", "103"},
{"a", "b", "c", "d", "e"}
};
This is the output part of my code:
Code:
Serial.print(KEYS[colIndex][rowIndex]);
Serial.println(": Keyboard Command - Instruction");
Keyboard.press(KEYS[colIndex][rowIndex]);
Keyboard.release(KEYS[colIndex][rowIndex])
In the Serial window I will get for example: KEY_UP....etc
No response with the PC generally though. I am not sure how to convert "KEYS[colIndex][rowIndex]" into a format that Keyboard.press() can execute.
I can write an IF/SWITCH statement to compare the value of the array result and hard code the Keyboard.press line for each one but that will involve a lot of code.
Any ideas?
(I haven't included the full code as I don't feel it adds anything to the issue).
Matthew
Last edited: