Xbee Explorer与arduino中的Xbee进行PC通信

问题描述 投票:1回答:0

我的电脑上有一个Xbee资源管理器,一个带有arduino无线屏蔽的arduino和另一个Xbee。 使用XCTU,我可以从arduino到PC接收数据,但是反之则不行,而是使用XCTU发送到arduino。 如果我从XCTU发送,则只有来自arduino无线屏蔽的LED RSSI已打开,但应该是RX LED。

这是我使用链接的教程

这是我在arduino上使用的代码,展位天线是S1 Xbee天线,天线都是默认值restore

// 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 communication explorer xbee
© www.soinside.com 2019 - 2024. All rights reserved.