Hello
I’m using netbeans and compiled this code ;
public class XbeeTest2 {
private static final String PORT = "COM4";
// TODO Replace with the baud rate of your sender module.
private static final int BAUD_RATE = 9600;
private static final String DATA_TO_SEND = "Hello XBee!";
private static final String REMOTE_NODE_IDENTIFIER = "REMOTE";
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println(" +--------------------------------------+");
System.out.println(" | XBee Java Library Send Data Sample |");
System.out.println(" +--------------------------------------+
");
XBeeDevice myDevice = new XBeeDevice(PORT, BAUD_RATE);
byte[] dataToSend = DATA_TO_SEND.getBytes();
try {
myDevice.open();
// Obtain the remote XBee device from the XBee network.
XBeeNetwork xbeeNetwork = myDevice.getNetwork();
RemoteXBeeDevice remoteDevice = xbeeNetwork.discoverDevice(REMOTE_NODE_IDENTIFIER);
if (remoteDevice == null) {
System.out.println("Couldn't find the remote XBee device with '" + REMOTE_NODE_IDENTIFIER + "' Node Identifier.");
System.exit(1);
}
System.out.format("Sending data to %s >> %s | %s... ", remoteDevice.get64BitAddress(),
HexUtils.prettyHexString(HexUtils.byteArrayToHexString(dataToSend)),
new String(dataToSend));
myDevice.sendData(remoteDevice, dataToSend);
System.out.println("Success");
} catch (XBeeException e) {
System.out.println("Error");
e.printStackTrace();
System.exit(1);
} finally {
myDevice.close();
}
}
======================================
however this is what I get
run:
±-------------------------------------+
| XBee Java Library Send Data Sample |
±-------------------------------------+
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Couldn’t find the remote XBee device with ‘REMOTE’ Node Identifier.
==================================
the Xbee works fine with the Xctu
thanks