![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
中継機能つけた受け取りオムニ
Dependencies: mbed MultiSerial
Diff: main.cpp
- Revision:
- 4:5da566692b79
- Parent:
- 3:1f1498403eec
- Child:
- 5:82d4d00847dd
--- a/main.cpp Tue Aug 19 11:58:06 2014 +0000 +++ b/main.cpp Wed Aug 20 05:11:21 2014 +0000 @@ -28,8 +28,7 @@ RawSerial xbee(p13,p14); //i2c init -int addr = 0x01; -char buff[1]; +const int addr = 0x01; //serial init volatile uint8_t INdata[DATA_NUM]={0}; @@ -38,11 +37,16 @@ void getData() //serial xbee to mbed { + char buff[1]; + static uint8_t RX=0, i; static uint8_t RXdata[DATA_NUM]={EN_KEYCODE}; static uint8_t RX_CHECKCODE=0; + RXdata[RX] = xbee.getc(); + if(RXdata[KEY]==EN_KEYCODE){ + RX++; } @@ -57,11 +61,12 @@ INdata[2] = RXdata[2]; } RX=0; - } - + buff[0]=INdata[1]; armMbed.write(addr,buff,1); buff[0]=0; + + } } int main() @@ -75,6 +80,6 @@ if(INdata[2]&0x40) motors = 0x50; //p25,p27 if(INdata[2]&0x80) motors = 0xA0; //p26,p28 - check = !check; + check = !check; } } \ No newline at end of file