HEPTA2Xbeeライブラリー

Dependencies:   HeptaXbee mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "HeptaXbee.h"
00002 HeptaXbee xbee(p9,p10);
00003 Serial pc(USBTX,USBRX);
00004 int main()
00005 {
00006 
00007     int i=0,rcmd=0,cmdflag=0;
00008     xbee.printf("Count Up!\r");
00009     while(1) {
00010         xbee.printf("num = %d\r",i);
00011         i++;
00012         wait(1.0);
00013         xbee.xbee_recieve(&rcmd,&cmdflag);
00014         pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag);
00015         if (cmdflag == 1) {
00016             if (rcmd == 'a') {
00017                 pc.printf("Command Get %d\r\n",rcmd);
00018                 xbee.printf("HEPTA Uplink OK\r");
00019             }
00020             xbee.initialize();
00021         }
00022     }
00023 }