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