NagaokaRoboticsClub_mbedTeam
/
mbed-os-RX-test
ver1
Diff: main.cpp
- Revision:
- 0:e89966d8e5d9
- Child:
- 1:393502eef76d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Aug 20 06:28:55 2018 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "FEP.h" +#include "cstdint" + +FEP fep(PA_0,PA_1,211); +Serial pc(USBTX,USBRX,115200); + +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"); + } + } +}