我想通过使用java api库来打开和关闭Xbee的引脚与不同的xbee(XB24-ZB)。使用Xbee java API
这是我的系统cunfig: 1.XBEE - Routher API(COM7) 2.XBEE - 协调员API(COM17)
其中两个是用相同的ID。 我使用的代码〔实施例:
XBee xbee = new XBee();
xbee.open("COM17", 9600);
// this is the Serial High (SH) + Serial Low (SL) of the remote XBee
XBeeAddress64 addr64 = new XBeeAddress64("00 13 A2 00 40 A7 3E 7E");
// Turn on DIO0 (Pin 20)
RemoteAtRequest request = new RemoteAtRequest(addr64, "D0", new int[XBeePin.Capability.DIGITAL_OUTPUT_HIGH.getValue()]);
xbee.sendAsynchronous(request);
RemoteAtResponse response = (RemoteAtResponse) xbee.getResponse();
if (response.isOk()) {
System.out.println("Successfully turned on DIO0");
} else {
System.out.println("Attempt to turn on DIO0 failed. Status: " + response.getStatus());
}
// shutdown the serial port and associated threads
xbee.close();
当我运行的代码块上的XBee#的DI0 1确实发生了改变,但为0(禁用),而不是5 我也得到这个错误:
log4j:WARN No appenders could be found for logger (com.rapplogic.xbee.api.InputStreamThread). log4j:WARN No appenders could be found for logger (com.rapplogic.xbee.api.InputStreamThread). log4j:WARN Please initialize the log4j system properly. log4j:WARN Please initialize the log4j system properly.
“AP”被设置为2,并且我得到的回应很好。 那么我在这里错过了什么? 谢谢