ZB Coord API for XBee: This XBee library drives Digi XBee ZB Modules in API Operation mode. Most commands include remote communication's are supported by the functions of this library. You can control XBee devices through the API software modules in this, without using any AT commands. Please refer to the following page and some of sample codes:

Dependents:   sample02_sw xbee_aging sample01_led sample04_sens

You are viewing an older revision! See the latest version

Homepage

Table of Contents

  1. Sample Code 1

XBee library 'ZB Coord API'

Sample Code 1

An XBee ZB Coordinator on a Nucleo Board controls LEDs on the other XBee ZB device.

sample

#include "xbee.h"
DigitalOut myled(LED1);
 
int main(){
    byte dev_gpio[]   = {0x00,0x13,0xA2,0x00,0x40,0x30,0xC1,0x6F};
         // MAC Address of your remote XBee device
    
    myled = 1;                          // NUCLEOのLEDをHレベル(3.3V)へ
    xbee_init( 0 );                     // XBee用COMポートの初期化
    xbee_atnj( 0xFF );                  // デバイスの参加を受け入れる
    myled = 0;                          // NUCLEOのLEDをHレベル(3.3V)へ
    
    while(1){                           // 永久に受信する
        myled = 1;                      // NUCLEOのLEDをHレベル(3.3V)へ
        xbee_gpo(dev_gpio,11,1);        // GPOポート11をHレベル(3.3V)へ
        xbee_gpo(dev_gpio,12,1);        // GPOポート12をHレベル(3.3V)へ
        wait(1);
        myled = 0;                      // NUCLEOのLEDをHレベル(3.3V)へ
        xbee_gpo(dev_gpio,11,0);        // GPOポート11をLレベル(0.0V)へ
        xbee_gpo(dev_gpio,12,0);        // GPOポート12をLレベル(0.0V)へ
        wait(1);
    }
}

All wikipages