Xbee test 2

Dependencies:   XBee mbed

main.cpp

Committer:
takashiyamanoue
Date:
2012-07-21
Revision:
0:ffac63d6a7f0

File content as of revision 0:ffac63d6a7f0:

#include "mbed.h"
#include "XBee.h"

XBee xbee(p13, p14);
Serial pc(USBTX, USBRX);

int main() {

    uint8_t Cmd[] = {'D', '4'};
    uint8_t Low[] = {0x04};
    uint8_t High[] = {0x05};
    XBeeAddress64 remoteAddress(0x0013A200, 0x403A8C82);
    RemoteAtCommandRequest remoteAtRequest;

    wait(1);
    xbee.begin(115200);

    while(1){
//    remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, Low, sizeof(Low));
       remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, Low, sizeof(Low));
//     remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd);
       remoteAtRequest.setApplyChanges(true);
       xbee.send(remoteAtRequest);
       
       wait(1.0);
       remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, High, sizeof(High));
//     remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd);
       remoteAtRequest.setApplyChanges(true);
       xbee.send(remoteAtRequest);
       wait(1.0);       

    }
}