Hi Everyone,
I’m trying to talk between two XBee’s (Series 1) that are set up point to point according to this example (http://examples.digi.com/get-started/basic-xbee-802-15-4-chat/4/). One is on the GHI Xbee module and the other an XBee USB explorer. The problem is I’m only able to talk one way between the USB explorer and the XBee module. When I send a byte from the Gadgeteer Xbee this is not seen in the serial console. In debugging this I replaced the Xbee Gadgeteer module with the USB serial module and the byte is read by the serial console, so it’s definitely being passed to the XBee.
I’m using hydra on 4.2. My code is below, I’m really just wanting to make sure that I’ve not done something silly or that there are any problems with this set up before I test it without the module.
Many thanks for any advice.
void ProgramStarted()
{
xBee.Configure(9600, GT.Interfaces.Serial.SerialParity.None, GT.Interfaces.Serial.SerialStopBits.One, 8);
xBee.SerialLine.Open();
xBee.SerialLine.DataReceived += new GT.Interfaces.Serial.DataReceivedEventHandler(SerialLine_DataReceived);
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
// Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
Debug.Print("Program Started");
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
Debug.Print("Pressed");
byte[] toWrite = { 0x13 };
xBee.SerialLine.Write(toWrite); // get reading of compass 3600
}
void SerialLine_DataReceived(GT.Interfaces.Serial sender, System.IO.Ports.SerialData data)
{
int recievedData = sender.ReadByte();
Debug.Print(recievedData.ToString());
}
}