I am doing a project with a receiver and transmitter and i am trying to get a message to print onto the screen. If anybody has any experience with this could you please help! I am trying to use a switch case command and it's not working. Edit:


#include <LiquidCrystal.h>
#include <VirtualWire.h>
LiquidCrystal lcd(12, 8, 5, 4, 3, 2);
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
void setup()
  Serial.println("Device is ready");

  // Initialize the IO and ISR
  vw_setup(2000); // Bits per sec
  vw_rx_start(); // Start the receiver
  lcd.begin(16, 2);

  // Print a message to the LCD.

void loop()
  if (vw_get_message(message, &messageLength)) // Non-blocking
    case 0:
      lcd.setCursor(0, 1);
    case 1 :
      lcd.setCursor(0, 1);
      lcd.print("Hi! :)");
      Serial.print("Received: ");
      for (int i = 0; i < messageLength; i++)
  • Show what you've tried.
    – dinotom
    May 11, 2016 at 19:21
  • Ive changed my code so many times so far, but at this moment it is: May 11, 2016 at 19:27
  • 1
    Okay! I finally got my code to post correctly! May 11, 2016 at 19:37
  • Please read How do I ask a good question?. You have described what you want. Now tell us what happens, and compare that to what you expected to happen.
    – Nick Gammon
    May 20, 2016 at 6:09

1 Answer 1


Too many pieces of the puzzle are missing for us to venture a guess on what is going wrong:

  • The output you get (both in the LCD and the serial console)

  • The message sent

One thing that strikes me as a potential problem is the


line. If you want to check the first character received, it should be


That said, it would perhaps help you if you tried to split the program into pieces and make sure each one works before advancing to the next. Are you sure the LCD pin connections and initialisation line match? (I know from experience it is very easy to mess up and put the pin numbers in the wrong order). It would help to put the following code right after the lcd.begin line (in your setup() function):

  lcd.setCursor(0, 0);

Now if this line doesn't display correctly, you will know it is the lcd connection/initialisation code that is at fault. Otherwise, you will concentrate on your communication code.

Give us more information and we 'll be able to help more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.