The two libraries do not work together. As soon as I use "vw_setup(2000);" LCD screen no longer works. I can't find a solution. It gives me weird characters
#include <VirtualWire.h>
#include <LiquidCrystal.h>
#define TxPin 12
LiquidCrystal lcd(5, 6, 8, 9, 10, 11);
void Demarage() {
int i = 0;
int j = 0;
int k =0;
bool Start =true;
while (Start) {
j++;
if (j > 3) {
i++;
j=0;
}
if (i>16) {
i=0;
k++;
}
if (k > 1) {
k=0;
Start=false;
lcd.clear();
}
delay(50);
lcd.clear();
lcd.setCursor(i, k);
lcd.print("Demarage");
}
}
void setup()
{
pinMode(A0,INPUT);
pinMode(A1,INPUT);
lcd.begin(16, 2);
pinMode(6, OUTPUT);
pinMode(12, INPUT);
Demarage();
Serial.begin(9600);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Loic V1"); // Before
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
lcd.setCursor(0, 1);
lcd.print("Loic V1"); // After, but no working
}
void loop() {
int y = analogRead(A0);
int x = analogRead(A1);
int int_x = x/4;
int int_y = y/4;
char x_String[4] = {'N','N','N','\0'};
char y_String[4] = {'N','N','N','\0'};
sprintf(x_String,"%d", int_x );
sprintf(y_String,"%d", int_y );
char msg[8]={'N','N','N','I','N','N','N','\0'};
if (int_x < 10) {
msg[0]=x_String[0];
}
if (int_x < 100 && int_x >= 10 ) {
msg[0]=x_String[0];
msg[1]=x_String[1];
}
if (int_x < 1000 && int_x >= 100 ) {
msg[0]=x_String[0];
msg[1]=x_String[1];
msg[2]=x_String[2];
}
if (int_y < 10) {
msg[4]=y_String[0];
}
if (int_y < 100 && int_y >= 10 ) {
msg[4]=y_String[0];
msg[5]=y_String[1];
}
if (int_y < 1000 && int_y >= 100 ) {
msg[4]=y_String[0];
msg[5]=y_String[1];
msg[6]=y_String[2];
}
Serial.println(msg);
digitalWrite(3, 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(3, false);
delay(50);
}
Could you help me ?