HEPTA-Sat Training 2019
/
Lab5-02_Uplink_OK_XBee
Lab5
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "HEPTA_COM.h" 00003 00004 Serial pc(USBTX,USBRX); 00005 HEPTA_COM com(p9,p10); 00006 00007 int main() 00008 { 00009 pc.baud(9600); 00010 com.baud(9600); 00011 pc.printf("Xbee Uplink Ok Mode\r\n"); 00012 int rcmd=0,cmdflag=0; 00013 for(int i = 0; i < 10; i++) { 00014 com.printf("num = %d\r\n",i); 00015 com.xbee_receive(&rcmd,&cmdflag); 00016 pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag); 00017 if (cmdflag == 1) { 00018 if (rcmd == 'a') { 00019 pc.printf("Command Get %d\r\n",rcmd); 00020 com.printf("HEPTA Uplink OK\r\n"); 00021 } 00022 com.initialize(); 00023 } 00024 wait(1.0); 00025 } 00026 }
Generated on Sat Aug 13 2022 05:46:29 by 1.7.2