4

这是我第一次使用 Xbee 模块。我正在使用两个 Xbee 模块 Serie 1。

它们的编程如下:

CH 10 ID 1 DH 0 DL 3 MY 2 CE 0

CH 10 ID 1 DH 0 DL 2 MY 3 CE 1

Arduino 正在运行这个:

const int ledPin = 13; // the pin that the LED is attached to
int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // read the oldest byte in the serial buffer:
  incomingByte = Serial.read();
 // if it's a capital H (ASCII 72), turn on the LED:
   if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
   } 
     // if it's an L (ASCII 76) turn off the LED:
   if (incomingByte == 'L') {
     digitalWrite(ledPin, LOW);
   }
}

所以,我把终端设备放在 arduino 上,使用 xbee shield,协调器放在 xbee explorer 上。使用 X-CTU 软件,我正在编写协调器,但没有任何反应。

4

1 回答 1

0

将协调器连接到 PC 后,您必须在 API 模式下配置协调器并让 X-CTU 在 API 模式下使用它, 启用 API 的 X-CTU

然后转到“终端”并单击“组装数据包”按钮并选择“HEX”单选按钮,现在您可以编写将由工作在 AT 命令模式下的终端设备接收的帧,该帧应如下所示:

  • 对于“L”值(L = 4C 是 ascii):
    7E 00 0F 10 01 00 00 00 00 00 00 FF FF FF FE 00 00 4C A1

  • 对于 'H' 值(H = 48 in ascii):
    7E 00 0F 10 01 00 00 00 00 00 00 FF FF FF FE 00 00 48 1E
于 2014-08-04T13:25:29.723 回答