Forum quick-typer uses Leonardo and keypad for common phrases

I ended up running out of buttons for all the things I wanted to say such as "please don't cross post".

This variation adopts the idea of a "shift key". The "" key on the keypad now puts the keypad into "shifted" mode. An LED (and resistor) connected to D13 glows to indicate you have the alternate set of messages. Pressing "" again cancels shift. Also it drops out of shift as soon as you use the shifted message (you could delete that line).

This now lets you have 30 messages rather than 16.

// Author: Nick Gammon
// Date: 5th July 2012
// Modified: 22 October 2012

 #include <Keypad2.h>

const byte ROWS = 4;
const byte COLS = 4; 

char keys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'},
};

byte rowPins[ROWS] = {6, 7, 8, 9}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {2, 3, 4, 5}; //connect to the column pinouts of the keypad
  
const byte ledPin = 13;
boolean alternateMessages = false;

  // Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup ()
{
  // initialize control over the keyboard:
  Keyboard.begin();
  pinMode (ledPin, OUTPUT);
}  // end of setup

void loop () 
  {
   
   // show which messages are active
   digitalWrite (ledPin, alternateMessages ? HIGH : LOW);
   
   byte key =  kpd.getKey();
   if (!key)
     return;
     
  if (alternateMessages)
    {
    switch (key)
      {
      case '1': Keyboard.println (F("Alternate message A")); break;
      case '2': Keyboard.println (F("Alternate message B")); break;
      case '3': Keyboard.println (F("Alternate message C")); break;

// ... and so on ...
 
      
      case '*': alternateMessages = false; break;
      
      } // end of switch
        
    // go back to main messages
    alternateMessages = false; 
    
    } // end of if alternate messages
    
  else
  
    // normal messages
    {
    switch (key)
      {
      case '1': Keyboard.println (F("http://www.gammon.com.au/interrupts")); break;
      case '2': Keyboard.println (F("http://www.gammon.com.au/i2c")); break;
      case '3': Keyboard.println (F("http://www.gammon.com.au/spi")); break;

// ... and so on ...
      
      case '*': alternateMessages = true; break;
        
      } // end of switch
      
    }  // end of normal messages
    
  } // end of loop

Tips:

You can do other things like adding a newline into your message:

        Keyboard.println ();

And if you want to arrow back inside a message (eg. do code tags and put the cursor back inside the tags):

        for (int i = 0; i < 8; i++) 
          {
          Keyboard.press (KEY_LEFT_ARROW);
          Keyboard.releaseAll();
          }