概述
Bees shield是DFRobot出品的一款Arduino兼容的xbee插座扩展板。 Bees shield拥有双xbee接口,能够很好地适应两种不同的xbee模块,是您连接通信设备非常重要的伙伴。第二串口使用软串口通信,避免占用了主串口,可直接堆叠到其他Arduino扩展板上。不用担心串口被占用。
技术规格
- Arduino兼容
- 具有2个xbee接口
- 2个xbee模块可使用硬件串口或模拟串口通讯,通过拨码开关和跳线切换(不支持两个模块同时使用模拟串口)。
- 具有自搭建电路焊盘
- 具有Arduino程序下载开关,隔离串口
- 尺寸:92X56mm
端口定义
 
警告:下载程序时一定要将RUN/PROG开关拨到PROG端. 不然Xbee将会占用串口,导致下载失败
编号5中,丝印代表的管脚为Xbee模块的TX和RX,并非Arduino代码中定义软串口的TX/RX。跳帽的连接方式需要和代码中定义的TX/RX引脚号相反:代码中定义的是软串口的 RX 和 TX,这边跳帽插的应该是xbee模块的 TX 和 RX,详情请见下面的使用教程,注意跳帽位置与代码中 TX,RX 的管脚区别。
模块使用教程
这个教程将会用两块 BLE Link(蓝牙无线通信模块)作为例子。
准备
- 硬件
- UNO控制板 x1
- Bees shield x1
- BLE LINK x2
- 安卓或者苹果手机 x1
 
- 软件
- Arduino IDE V1.6.5 点击下载Arduino IDE
- Android手机用户:安装 APK 文件 到你的安卓手机中
- Apple手机用户: 使用Xcode编译 IOS 源代码 进入IOS设备
 
 
注意:下载程序的时候将Xbbs shield PROG/RUN开关拨到PROG一端
Bee1使用硬件串口 Bee2使用软串口
硬件连接图

样例代码
/*
 # This sample code is used to test the Bees shield.
 # Editor : Mickey
 # Ver    : 1.0
 # Product: Bees shield
 # SKU    : DFR0210
 # The circuit:
   software RX is digital pin 2 (connect to TX of Bee2 device)
   software TX is digital pin 3 (connect to RX of Bee2 device)
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // UNO RX -- Bee TX, UNO TX -- Bee RX
void setup()
{
  Serial.begin(115200);
  mySerial.begin(115200);
  delay(50);
}
void loop()
{
  Serial.println("this is Bee1 hardware!");
  mySerial.println("this is Bee2 software!");
  delay(500);
}
结果
Bee2使用硬件串口,Bee1使用软串口
硬件连接图

样例代码
    /*
     # This sample code is used to test the Bees shield.
     # Editor : Mickey
     # Ver    : 1.0
     # Product: Bees shield
     # SKU    : DFR0210
     # The circuit:
       software RX is digital pin 2 (connect to TX of Bee1 device)
       software TX is digital pin 3 (connect to RX of Bee1 device)
    */
    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 3); // UNO RX -- Bee TX, UNO TX -- Bee RX
    void setup()
    {
      Serial.begin(115200);
      mySerial.begin(115200);
      delay(50);
    }
    void loop()
    {
      Serial.println("this is Bee2 hardware!");
      mySerial.println("this is Bee1 software!");
      delay(500);
    }
结果
切换两个硬件串口输出
硬件连接图
EN跳线控制硬串口切换脚,下方的软串口选择跳线不工作

样例代码
/*
 # This sample code is used to test A Arduino hardware serial switch.
 # Editor : Mickey
 # Ver    : 1.0
 # Product: Bees shield
 # SKU    : DFR0210
*/
void setup()
{
  Serial.begin(115200);
  pinMode(4, OUTPUT);
  delay(500);
}
void loop()
{
  digitalWrite(4, LOW);
  Serial.println("this is Bee1 hardware!");
  Serial.println(" ");
  delay(500);
  digitalWrite(4, HIGH);
  Serial.println("this is Bee2 hardware!");
  Serial.println(" ");
  delay(500);
}
结果
注意
Bees Shield只支持以上三种模式的设置,不能将两个都设置成软串口!
相关文档
常见问题
还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!
更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖!

