VirtualWire and LiquidCrystal Library cooperation?

I have been working with a temperature controlling system. Problem is that Virtualwire and LiquidCrystal
Library don’t work together. The LCD works well without VirtualWire.

When I use VirtualWire library the LCD stops working correctly. For example, setCursor-function
doesn’t work at all, clear-function doesn´t clear, it puts extra character to LCD etc.
VirtualWire works OK together with LCD (FM transmitter transmits characters correctly).

Here is a test code:

// Board: Arduino Uno
// Arduino 21
// Hitachi HD44780 compatible LCD (4 bit mode)
// LiquidCrystal Library
// RF Link Transmitter -434MHz
// VirtualWire Library 1.5

#include <VirtualWire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(11, NULL, 12, 7, 8, 9, 10);

char msg[24];
int Whole = 20;
int Fract = 35;

void setup(void)

void loop(void)
sprintf(msg, “%i,%i”, Whole, Fract);
vw_send((uint8_t *)msg, strlen(msg));

Can anyone help? I’ve spent three evenings on this and need some expert assistance.

LiquidCrystal lcd(11, NULL, 12, 7, 8, 9, 10);

Start by removing the 'NULL' entry to give LiquidCrystal lcd(11, 12, 7, 8, 9, 10); and see what happens. You shouldn't need the delays after the LCD functions, but they shouldn't cause any problems either.


I remove NULL and delays but it doesn't help. No effect.


Where do you set the receive pin?

4.2 vw_set_rx_pin
extern void vw_set_rx_pin(uint8_t pin);
Set the digital IO pin to use for receive data. Defaults to 11.

You are using pin 11 for the LCD.

My real system consists of two Arduino Unos. FM receiver is connected to other Arduino - not the one which has FM transmitter. So FM receiver don't affect VirtualWire pins. FM transmission is OK.


maybe you should try to set another port for rx, even if it is not used. Just to be sure VirtualWire doesn't configure this port.

Thanks PaulS and moustic - your advice helps. After I have added function vw_set_rx(4) and changed the order of the functions (after the VirtualWire library description) LCD works OK.

The relevant functions in order:

vw_set_tx(5); vw_set_rx(4); // This function needed vw_setup(2000); // This function was not in right place

Thanks, projects go on ...