Combining Keypad, LCD and Virtual Wire Libraries

At the moment I am creating a project that involves the use of the following libraries:

The project is and LCD Keypad unit which check a combination. Once the correct combination has been entered it transmits a signal telling another box to open.
Here is the code I am using:

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {16, 15, 14}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

int combination = 1;
int led13 = 13;

void setup(){
  vw_setup(2000);       // Bits per sec
  lcd.begin(16, 2);
  pinMode(led13, OUTPUT);
void loop(){

  char key = keypad.getKey();
  if (key != NO_KEY){

  switch (key) {
    case '1':    
      combination += 1;
    case '2':    
      combination *= 2;
    case '3':    
      combination += 3;
    case '4':    
      combination -= 4;
    case '5':    
      combination *= 5;
    case '6':    
      combination += 6;
    case '7':    
      combination += 7;
    case '8':    
      combination += 8;
    case '9':    
      combination *= 9;
    case '0':    
      combination *= 10;
    case '*':
    if (combination == 57250)
      const char *msg = "b";
      digitalWrite(13, true); // Flash a light to show transmitting
      vw_send((uint8_t *)msg, strlen(msg));
      vw_wait_tx(); // Wait until the whole message is gone
      digitalWrite(13, false);

When I put the VirtualWire and LiquidCrystal libraies together they work fine.
When I put the LiquidCrystal and Keypad Libraries together they work fine too.

However when I try to put the LiquidCrystal, Keypad and VirtualWire libraries together the Keypad has trouble operating.
When they are together the following occurs:

  1. On the LCD the Numbers 4,5,6 are repated over and over.
  2. The keys 4,5,6 don't work where as the other keys do

So I am not sure what to do. Does anyone know if these libraries can be used together or not. If they can what can I do to use them together.

Any advice will be helpful

It is possible your Sketch is running out of memory. Which board are you using?

Are you certain that the VirtualWire library does not use a 'hardwire' pin? I seem to remember it being 11 and 12?

Then it is probably a bad idea to use 11 for the keypad library as well.

I am using the Atmega168-20PU chip on a Arduino Diecimila

To: AlphaBeta

Thanks for the help, you were right, pin 12 and pin 11 are used in the virtualwire library. 11 as a reciever and 12 as a transmitter. Even though I was using only the transmitter program the library still set pin 11 as a reciever pin. Now I have reporgramed it so that the keypad doesn't uses that leg anymore.

Thank you so much
from /me

To: Coding Badly

Thanks for the help!