Hi guys; i’m trying a simple thing actually but I’ve been testing and on here looking for answers for hours.
I want to display the message sent by RF module on the LCD.
Got the RF working, message is sent and received.
Got the display working, first line is filled with a value.
I can also display the received message in de debugging serial monitor.
but how can I display this value on the second line on the LCD?
Transmitter code which is working fine:
// Transmitter setup
// WRL-10534 PIN1=GND PIN2=DATA PIN3=5V PIN4=ANT
// ARDUINO UNO PIN12=DATA PIN13=LED
// Sends plain text message to 434MHz
#include <VirtualWire.h>
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
}
void loop()
{
const char *msg = "hello";
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);
Serial.println(msg);
delay(2000);
}
Receiver code which has RF receiving and LCD working
// Receiver setup
// WRL-10532 PIN1=GND PIN2=DATA PIN4=5V PIN8=ANT
// ARDUINO UNO PIN2=DATA PIN13=LED
// Receives plain text message from 434MHz
#include <VirtualWire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 10);
int Sensor1Data;
char Sensor1CharMsg[24];
void setup()
{
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
lcd.begin(16, 2);
lcd.print("line1");
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
vw_set_rx_pin(2);
vw_rx_start(); // Start the receiver PLL running
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;
digitalWrite(13, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
Serial.print((char) buf[i]);
}
Serial.println("");
digitalWrite(13, false);
}
}
Please show me how to display the message on the LCD.
Thanks in advance!