我在pc上有一个Xbee浏览器,还有一个带有arduino无线屏蔽的arduino,还有另一个Xbee。使用XCTU我可以从arduino接收数据到PC,但不能反过来接收数据,使用XCTU将数据发送到arduino。如果我从XCTU发送,只有来自arduino无线屏蔽的led RSSI是打开的,但它应该是RX led。
这是我在arduino上使用的代码,展位天线是S1 Xbee天线,天线都是默认值恢复
// We'll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
SoftwareSerial XBee(10,11); // RX, TX
void setup()
{
// Set up both ports at 9600 baud. This value is most important
// for the XBee. Make sure the baud rate matches the config
// setting of your XBee.
XBee.begin(9600);
Serial.begin(9600);
}
void loop()
{
if (Serial.available())
{ // If data comes in from serial monitor, send it out to XBee
Serial.println("first if");
XBee.write(Serial.read());
}
if (XBee.available())
{ // If data comes in from XBee, send it out to serial monitor
Serial.println("second if");
Serial.write(XBee.read());
}
}
发布于 2021-10-21 08:56:49
请精确地确定您的两个xbee模块的操作模式(使用XBEE3时可能很难通信),以及它们的DL、DH
https://stackoverflow.com/questions/29899479
复制相似问题