Xbee Uplink
Dependencies: mbed PowerControl SDFileSystem
Fork of HeptaXbee_Uplink by
main.cpp@3:15a7f7fa174a, 2016-12-14 (annotated)
- Committer:
- MEXT1
- Date:
- Wed Dec 14 16:09:56 2016 +0000
- Revision:
- 3:15a7f7fa174a
- Parent:
- 2:1bdae7d5814e
Xbee Uplink
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tomoya123 | 0:9a52d95a79f7 | 1 | #include "mbed.h" |
tomoya123 | 0:9a52d95a79f7 | 2 | #include "HeptaXbee.h" |
tomoya123 | 0:9a52d95a79f7 | 3 | |
tomoya123 | 0:9a52d95a79f7 | 4 | Serial pc(USBTX,USBRX); |
tomoya123 | 0:9a52d95a79f7 | 5 | HeptaXbee xbee(p9, p10);//(tx,rx)=(Din,Dout) |
tomoya123 | 0:9a52d95a79f7 | 6 | |
tomoya123 | 0:9a52d95a79f7 | 7 | int main() { |
tomoya123 | 0:9a52d95a79f7 | 8 | pc.baud(9600); |
tomoya123 | 0:9a52d95a79f7 | 9 | xbee.baud(9600); |
tomoya123 | 0:9a52d95a79f7 | 10 | pc.printf("Xbee Uplink Ok Mode\r\n"); |
tomoya123 | 0:9a52d95a79f7 | 11 | int rcmd=0,cmdflag=0; |
tomoya123 | 0:9a52d95a79f7 | 12 | for(int i=1;i<10;i++){ |
tomoya123 | 0:9a52d95a79f7 | 13 | xbee.printf("num = %d\r\n",i); |
tomoya123 | 0:9a52d95a79f7 | 14 | xbee.xbee_recieve(&rcmd,&cmdflag); |
tomoya123 | 0:9a52d95a79f7 | 15 | pc.printf("rcmd=%d,cmdflag=%d\r\n",rcmd,cmdflag); |
tomoya123 | 0:9a52d95a79f7 | 16 | if(cmdflag==1){ |
tomoya123 | 1:c0aa8983398d | 17 | if(rcmd=='a'){ |
MEXT1 | 2:1bdae7d5814e | 18 | pc.printf("Command Get\r\n"); |
MEXT1 | 3:15a7f7fa174a | 19 | xbee.printf("HEPTA Uplink OK\r\n"); |
tomoya123 | 1:c0aa8983398d | 20 | } |
tomoya123 | 0:9a52d95a79f7 | 21 | xbee.initialize(); |
tomoya123 | 0:9a52d95a79f7 | 22 | } |
tomoya123 | 0:9a52d95a79f7 | 23 | wait (1.0); |
tomoya123 | 0:9a52d95a79f7 | 24 | } |
tomoya123 | 0:9a52d95a79f7 | 25 | } |