LCD with VirtualWire doesn't work properly

Hi all,
this is the scenario:

" I try to use LCD with VirtualWire Library but without success. I didn’t have back issues from the compiler but the LCD stop to work when I add VirtualWire part. "

What I’ve try to is:

  • Change inside VirtualWire the Default Tx,RX, PPT Pin → But Without success
// Set the digital IO pin to be for transmit data 
   vw_set_tx_pin(uint8_t pin);
   vw_set_rx_pin(uint8_t pin);
   vw_set_ptt_pin(uint8_t pin);

The Display is configured like into the example below reported:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:

Can I try to change PIN for LCD ? or are particular Pin ?

Have you already encountered this kind of issues ?

Thanks in advance for the help,

The code you have given does not mention VirtualWire at all. Please give the code you are actually using.

What do you have wired up that you are using Virtual Wire? Is it a radio? Have you confirmed that the VirtualWire part does or does not work independently of the LCD?

So, virtual wire it’s working when try to emulate the LCD in Serial … when I enable the LCD the LCD doesn’t work … so If comment the VIRTUAL WIRE part the LCD start to work … so you can take a simple example for example something like this because is a general issues …

#include <VirtualWire.h>
#include <LiquidCrystal.h>
#include "M2tk.h"
#include "utility/m2ghlc.h"

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

uint8_t uiKeySelectPin = 10;
uint8_t uiKeyNextPin = 9;

uint8_t select_color = 0;
uint8_t select_priority = 0;

void setup()
    m2_SetLiquidCrystal(&lcd, 16, 4);
    m2.setPin(M2_KEY_SELECT, uiKeySelectPin);
    m2.setPin(M2_KEY_NEXT, uiKeyNextPin);	

void fn_ok(m2_el_fnarg_p fnarg) {
  /* accept selection */

void fn_cancel(m2_el_fnarg_p fnarg) {
  /* discard selection */

const char *fn_idx_to_color(uint8_t idx)
  if ( idx == 0 )
    return "red";
  else if (idx == 1 )
    return "green";
  return "blue";

const char *fn_idx_to_priority(uint8_t idx)
    case 0: return "lowest";
    case 1: return "low";
    case 2: return "medium";
    case 3: return "high";
    case 4: return "highest";
  return "";

M2_LABEL(el_label1, NULL, "Color:");
M2_COMBO(el_combo1, NULL, &select_color, 3, fn_idx_to_color);

M2_LABEL(el_label2, NULL, "Prio.: ");
M2_COMBO(el_combo2, "v1", &select_priority, 5, fn_idx_to_priority);

M2_BUTTON(el_cancel, NULL, "cancel", fn_cancel);
M2_BUTTON(el_ok, NULL, " ok ", fn_ok);

M2_LIST(list) = { 
    &el_label1, &el_combo1, 
    &el_label2, &el_combo2,  
    &el_cancel, &el_ok 
M2_GRIDLIST(list_element, "c2",list);
M2tk m2(&list_element, m2_es_arduino, m2_eh_2bs, m2_gh_lc);

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);
    if ( m2.handleKey() )

then looking the library by default VirtualWire use rx 11 pin tx 12 pin then I’ve change the pin but still to have the issues …

please let me know if you need more information,

Best regards,

Your code does not tell VirtualWire which pins to use..

If you read the docs at

4.1 vw_set_tx_pin extern void vw_set_tx_pin(uint8_t pin); Set the digital IO pin to use for transmit data. Defaults to 12. 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.

The default pins (11, 12) collide with the ones you've picked for your LCD. Use the above APIs to set the pins you will actually use.

Yes si using the default pin ... So can i use each pin for display ?

Thx Gnux

I guess that what I don't understand is why you want to use the LCD on the default VW pins and move the VW class to other pins. Why not just move the LCD to something other than the VW pins?

I've tried but specifying other PIN for virtual Wire doesn't works ... then specifying other pin for LCD it's working... my question is all pin can be used for LCD ?

Thanks gnux

my question is all pin can be used for LCD ?

Any unused pin, yes.

Ok thanks , perfect very useful :-)