Little keyboard shortcut?

Hello I'm building a small keyboard shortcut with 6 button keys. The problem I'm having is that i have 16 to 17 shortcuts i need to make to help me out daily. I know using the keyboard libray i can make 6 shortcuts. However i do not know how to make a 16 to 17 shortcut function switching so one button can do different functions.

So my question is there an example i can take a look at to get me started on how to figure out to get me started?


Can you please post the code you have that works, then we can advise any edits?
Can you post a circuit to show how you have the keypad or keyboard connected.

Is it a keypad or keyboard?

Tom... :smiley: :+1: :coffee: :australia:

Hello TomGeorge, This is my code it is something i found online and i added 3 more to the example for 6 keys. I'm not much of a coder but I'm learning to figure things out.

 * Arduino Keyboard Emulation
 * learnelectronics
 * 13 FEB 2017

#include <Keyboard.h>    // This is a "built-in" library no need to install

//                           Setup

void setup() {
pinMode(3,INPUT_PULLUP);  // sets pin 3 to input & pulls it high w/ internal resistor
pinMode(4,INPUT_PULLUP);  // sets pin 4 to input & pulls it high w/ internal resistor
pinMode(5,INPUT_PULLUP);  // sets pin 5 to input & pulls it high w/ internal resistor
pinMode(6,INPUT_PULLUP);  // sets pin 6 to input & pulls it high w/ internal resistor
pinMode(7,INPUT_PULLUP);  // sets pin 7 to input & pulls it high w/ internal resistor
pinMode(8,INPUT_PULLUP);  // sets pin 8 to input & pulls it high w/ internal resistor

Serial.begin(9600);       // begin serial comms for debugging


//                           Loop

void loop() {
 Keyboard.begin();         //begin keyboard 
 if (digitalRead(3) == 0)  // if buton 3 is pushed
    Keyboard.write(0x80);  // send Hex value for KEY_LEFT_CTRL key
    delay(200);           // delay so you don't get 20 A's
  else if (digitalRead(4) == 0){  // if button 4 is pressed
    Keyboard.write('A');  // send single character "A"
  else if (digitalRead(5) == 0){  //if button 5 is pressed
    Keyboard.write(0xB0);         // send Hex value for RETURN key
  else if (digitalRead(6) == 0){  //if button 5 is pressed
    Keyboard.write(0xD8);         // send Hex value for KEY_LEFT_ARROW key
  else if (digitalRead(7) == 0){  //if button 5 is pressed
    Keyboard.write(0xD7);         // send Hex value for KEY_RIGHT_ARROW key
  else if (digitalRead(8) == 0){  //if button 5 is pressed
    Keyboard.write(0xC7);         // send Hex value for KEY_F6 key
  Keyboard.end();                 //stops keybord

Edit: I'm using just Soft Tactile Button i found online. With diodes so i can do multiple button presses. that i have found online here.


To get more than six functions out of six keys,

  • one or more keys could be defined as "shift",
  • read and interpret multiple simultaneous button presses,
  • distinguish between short and long key presses.

What do you have in mind?

I'm Thinking of putting a button in to do different functions for each key.

My Keys i need are:

CTRL + a
CTRL + v
CTRL + z
CTRL + y
Left Arrow
Right Arrow
Enter return key

These are programs to be open somehow

Ms Paint
and Arduino IDE for now.

I might add a few more. But this will help me in my everyday tasks trying to open things and use button presses i use a lot.


What model Arduino controller are you using?

Tom... :smiley: :+1: :coffee: :australia:

I suspect that you're going to need to look at the press and release functions, at least for the control key. I assume that with what you have if you press control and 'A', you just get an 'A', correct?

Hello i have a few board the arduino leonardo, a Uno board and a Arduino zero board. The leonardo and Zero board both have native usb that would work great for something like this. So I'm deciding on which one.


Hello, let me tackle the first problem. How can i do multiple key presses at one time? Say with a single keypress? At the moment all i know and can do is a single keypress but use multiple hardware keys.


Why not get a 12 or 16 button keypad, and stick with one function per button press?

You can buy one or salvage them from old phones, discarded code entry keypads, etc. from a thrift shop nearby.

Because it is much more fun to build something then to buy a complete package. And try and learn to figure out how to program it. If i fail, I fail but at least I'm trying.