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.begin(9600);
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
{
switch(message[1])
{
case 0:
lcd.setCursor(0, 1);
lcd.print("O.O");
break;
case 1 :
lcd.setCursor(0, 1);
lcd.print("Hi! :)");
break;
}
{
Serial.print("Received: ");
for (int i = 0; i < messageLength; i++)
{
Serial.write(message[i]);
}
Serial.println();
}
}
}