中継機能つけた受け取りオムニ
Dependencies: mbed MultiSerial
Diff: main.cpp
- Revision:
- 18:9cbd70819d2d
- Parent:
- 17:3c82070177e5
- Child:
- 19:1305ce40f4e2
diff -r 3c82070177e5 -r 9cbd70819d2d main.cpp --- a/main.cpp Fri Sep 26 09:26:27 2014 +0000 +++ b/main.cpp Sat Sep 27 00:46:43 2014 +0000 @@ -58,7 +58,8 @@ uint8_t get_data[DATA_NUM]= {0}; -uint8_t check_data[1]; +uint8_t check_data[2]={0}; + /* Out put PC stdout function */ void pc_print() @@ -73,14 +74,34 @@ count++; } +uint8_t readable_ratio(){ + + int check = 0; + + for(int i=0;i>=100;i++){ + + if(xbee.readable_check()==1){check++;} + + wait_ms(1.0); + } + return check; + } + void connect_check(void) { xbee.start_read(); xbee.read_data(check_data,XBEE_KEY); + + check = 0x01; + + while(readable_ratio()>=50); + + check = 0x03; + + while(readable_ratio()<=50); - while(check_data[0]!=0xCC); - while(check_data[0]==0xCC); - + check = 0x07; + xbee.stop_read(); xbee.start_write(); @@ -110,7 +131,7 @@ wait(count*10e-3); //count value * 0.01 sec } - check = 0; + //check = 0; } int main() @@ -158,7 +179,6 @@ } else { counter++; - check = 0xFF; } /* PWM */