【发布时间】:2015-07-06 03:02:31
【问题描述】:
我的电脑上有一个 Xbee 浏览器,一个带有 arduino 无线屏蔽的 arduino 和另一个 Xbee。使用 XCTU,我可以从 arduino 接收数据到 PC,但不能反过来,使用 XCTU 发送到 arduino。 如果我从 XCTU 发送,则只有 arduino 无线屏蔽的 LED RSSI 处于打开状态,但它应该是 RX LED。
这是我正在使用的教程Link
这是我在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());
}
}
【问题讨论】:
-
如果您在 Arduino 和 XBee Explorer 之间交换物理 XBee 模块,会发生什么?数据是否仍然从 Arduino 流向 X-CTU,还是只流向另一个方向?如果方向发生变化,则与无线电的配置方式有关。确保协调器上的
DH和DL值与路由器上的SH和SL值相对应。 -
如果我切换它们,问题仍然存在,arduino 发送并且 X-CTU 接收,但如果尝试从 X-CTU 发送,则不会附加任何内容。我已经尝试了 DH 和 DL 以及 SH 和 SL 的值,问题仍然存在。
-
好的,您已经确认这是从 X-CTU 发送或在 Arduino 上接收的问题。两个 XBee 模块都能够从对方接收数据。您是否在 XBee 模块上启用了硬件握手?如果是这样,Arduino 需要在 XBee 模块发送数据之前断言 RTS。看看 ATD6 和 ATD7,确保它们在 Arduino 的 XBee 上被禁用(因为 Arduino 串行端口不支持硬件握手)。
-
您好 tomlogic 感谢您的所有回答,但我已禁用 Arduino 上 Xbee 的 ATD7 和 ATD6,问题仍然存在。
-
您需要验证屏蔽的硬件配置,可能会将逻辑分析仪连接到 XBee 模块的
DOUT引脚以查看是否有任何信息通过。
标签: arduino communication explorer xbee