![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
HEPTA2Xbee_
Fork of HEPTA_Xbee by
main.cpp@1:9bf7fa8a7615, 2017-07-19 (annotated)
- Committer:
- hepta2ume
- Date:
- Wed Jul 19 08:01:08 2017 +0000
- Revision:
- 1:9bf7fa8a7615
Hepta2_xbee_(0719)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hepta2ume | 1:9bf7fa8a7615 | 1 | #include "HeptaXbee.h" |
hepta2ume | 1:9bf7fa8a7615 | 2 | HeptaXbee xbee(p9,p10); |
hepta2ume | 1:9bf7fa8a7615 | 3 | Serial pc(USBTX,USBRX); |
hepta2ume | 1:9bf7fa8a7615 | 4 | int main() |
hepta2ume | 1:9bf7fa8a7615 | 5 | { |
hepta2ume | 1:9bf7fa8a7615 | 6 | |
hepta2ume | 1:9bf7fa8a7615 | 7 | int i=0,rcmd=0,cmdflag=0; |
hepta2ume | 1:9bf7fa8a7615 | 8 | xbee.printf("Count Up!\r"); |
hepta2ume | 1:9bf7fa8a7615 | 9 | while(1) { |
hepta2ume | 1:9bf7fa8a7615 | 10 | xbee.printf("num = %d\r",i); |
hepta2ume | 1:9bf7fa8a7615 | 11 | i++; |
hepta2ume | 1:9bf7fa8a7615 | 12 | wait(1.0); |
hepta2ume | 1:9bf7fa8a7615 | 13 | xbee.xbee_recieve(&rcmd,&cmdflag); |
hepta2ume | 1:9bf7fa8a7615 | 14 | pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag); |
hepta2ume | 1:9bf7fa8a7615 | 15 | if (cmdflag == 1) { |
hepta2ume | 1:9bf7fa8a7615 | 16 | if (rcmd == 'a') { |
hepta2ume | 1:9bf7fa8a7615 | 17 | pc.printf("Command Get %d\r\n",rcmd); |
hepta2ume | 1:9bf7fa8a7615 | 18 | xbee.printf("HEPTA Uplink OK\r"); |
hepta2ume | 1:9bf7fa8a7615 | 19 | } |
hepta2ume | 1:9bf7fa8a7615 | 20 | xbee.initialize(); |
hepta2ume | 1:9bf7fa8a7615 | 21 | } |
hepta2ume | 1:9bf7fa8a7615 | 22 | } |
hepta2ume | 1:9bf7fa8a7615 | 23 | } |