Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: sample02_sw xbee_aging sample01_led sample04_sens
You are viewing an older revision! See the latest version
Homepage
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);
}
}