Good afternoon.
I need to make a keyboard with arduino leonardo and I am using matrix board.
In the table I need a multiple key like for example shift+insert.
does anyone know how i can do it
Good afternoon.
I need to make a keyboard with arduino leonardo and I am using matrix board.
In the table I need a multiple key like for example shift+insert.
does anyone know how i can do it
Welcome to the forum
Have you looked at the MultiKey example from the Keypad library ?
[quote="UKHeliBob, post:2, topic:1208253, full:true"]
Welcome to the forum
Have you looked at the MultiKey example from the Keypad library ?
[/quot
Thank you for your reply.
I have seen it but it only mentions pressing multiple buttons.
it does not mention them in a matrix
Really ?
Here are the first few lines of the sketch
|| @description
|| | The latest version, 3.0, of the keypad library supports up to 10
|| | active keys all being pressed at the same time. This sketch is an
|| | example of how you can get multiple key presses from a keypad or
|| | keyboard.
|| #
*/
#include <Keypad.h>
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','#'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the kpd
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
maybe I didn't ask the question well.
could we have multiple clicks on one button??
diladi in the table of the example instead of having the position 1 I had.
{'KEY_LEFT_SHIFT+KEY_INSERT ', '2', '3'},
You can only have a single character or byte value on a key but once you detect that key as having been pressed then it is up to you what you do in your sketch
are you telling me that I can make the matrix and as a hypothesis define that if 1 key is pressed, will be sent as an output KEY_LEFT_SHIFT +KEY_INSERT?
I am telling you that you can decide what to do whatever you like on receipt of any key, even though they keypad sends only a single character.
Some pseudo code
read key from keypad
if key equals 's'
print "Mary had a little lamb"
else if key equals 't'
turn on LED
else if key equals '#'
send "rubbish" to the PC keyboard input
end if
Hi @dimtom
welcome to the arduino-forum.
If you explain with more details and if you provide more information much better suggestions taylored to your project can be made.
You should provide a picture how your matrix-board looks like
you should post a link to the datasheet of your matrix-board
You should describe to what kind of device you want to send "shift+insert" etc.
You should describe over what kind of interface you want to send "shift+insert" etc.
You should give an overview about your project and describe what the final purpose of sending keystrokes like "shift+insert" is.
best regards Stefan
Thank you very much, I will try it and get back to you
As @StefanL38 has suggested, if you tell us what you want to do it will be easier to provide help
From the fact that you have used 'KEY_LEFT_SHIFT+KEY_INSERT ' as your example it looks like you want to press a single key on the keypad and send keyboard commands to the PC. Is that what you are doing ?
By the way, 'KEY_LEFT_SHIFT+KEY_INSERT ' is meaningless anyway, because a pair of single quotes can only be used with a single character, not a multi character string or String
yes that is to i want. i need to press a single key on the keypad and sent keyboard commands to the pc double keys
Using something like the code in post #8 you can do whatever you like on receipt of a single keypad button press but, of course, you need to turn it into real code
when you can send me a complete code so that I can see the options with a 2x2 matrix and then I will do it in 7x7 that I want
Never
It is time for you to write some code. Have you looked at the Keypad library examples ?
ok.. i will see all the examples.
I will try to write the code.
and where I don't understand, correct me if you have time.
Start with HelloKeypad and adapt it
because I can't figure out how to do it with matrix if I do it with button combination with
void loop() {
if while (digitalRead(2) == HIGH) && (digitalRead(3)==HIGH {
delay(500);
}
delay(1000);
Keyboard.press(ctrlKey);
Keyboard.press('n');
delay(100);
Keyboard.releaseAll();
delay(1000);
}
do you think it will work
Please make up your mind whether you want to press 2 buttons or 1 button in order to send multiple keypresses
Look again at the HelloKeypad example. Change
if (key)
to
if (key == '1')
{
//put the code to be run when the user presses the '1' key here
}
i don't found that example