Xbee + SerLCD: problem with LCD.print...

Hi all,

This is my first post...I thank you in advance for reading & helping!

I am trying to get two arduino with Xbee attached talking to each other. The transmitter unit will send some characters, and then depending on what character is broadcasted the receiver unit (with SerLCD attached) will print some selection of texts. Here are my codes:

Transmitter:

void setup()
{
Serial.begin(9600);
}

void loop()
{
Serial.print('X');
delay(1000);
Serial.print('O');
delay(1000);
}

Receiver:

#include <SoftwareSerial.h>
#define txPin 9
SoftwareSerial LCD = SoftwareSerial(0, txPin);

void setup()
{
Serial.begin(9600);
pinMode(txPin, OUTPUT);
pinMode(13, OUTPUT);
LCD.print(0x7C, BYTE); //command flag for backlight stuff
LCD.print(128, BYTE); //light level
}

void loop()
{
while (Serial.available() > 0)
{
char c = Serial.read();
if (c == 'X')
{
LCD.print("This Thing"); //print
delay(500);
}
if (c == 'O')
{
LCD.print("THis Other Thing"); //print
delay(500);
}
}
}

My Xbees are sitting on top of xbee shields. I tested the Xbee units and I am able to send Xs and Os between them without problem. But the LCD just wouldn't print anything. I tried modifying the codes to get the LCD to just print whatever is seen by Serial.read, and that didn't work either...What did I do wrong?

Thanks!! - David

Have you tried looking at the serial monitor on both ends? That should provide some useful debugging information.

Also, it seems obvious so you probably already did this, but have you been able to print anything to your LCD regardless of the wireless information?

Yes I tested the LCD and I am able to print stuff on it - when I am not asking Arduino to also listen to the serial port...Basically, sending and receiving Xs and Os serially is fine on its own, printing to LCD is fine on its own, but try putting the two together then nothing happens... =(

It might have something to do with the management of multiple instances of serial communication in NewSoftSerial? I found this link but I don't think I fully understand the solution....NewSoftSerial | Arduiniana

  • D