NagaokaRoboticsClub_mbedTeam
/
mbed-os-RX-test
ver1
Diff: main.cpp
- Revision:
- 1:393502eef76d
- Parent:
- 0:e89966d8e5d9
--- a/main.cpp Mon Aug 20 06:28:55 2018 +0000 +++ b/main.cpp Tue Aug 28 04:43:49 2018 +0000 @@ -1,28 +1,12 @@ #include "mbed.h" -#include "FEP.h" -#include "cstdint" +#include "kinectRX.h" -FEP fep(PA_0,PA_1,211); Serial pc(USBTX,USBRX,115200); - +KinectRX fep; int main() { - char data[256]; - uint8_t temp,len; - while(1) { - len = 5; - temp = fep.read(data,len); - if(temp == 0) { - pc.printf("recieved\r\n"); - pc.printf("%d--%d\r\n",data[0]*1000+data[1]*100+data[2]*10+data[3],data[4]); - } else if(temp == 1) { - pc.printf("recieved data error\r\n"); - } else if(temp == FEP_DT_ERR) { - pc.printf("program or recieve error\r\n"); - } else if(temp == FEP_DT_BIN) { - pc.printf("transmitter is binary mode\r\n"); - } else { - pc.printf("No response\r\n"); - } + while(1){ + fep.receive_data(); + printf("mode..%d distance..%d\n\r",fep.get_mode(),fep.get_distance()); } }