ver1

Dependencies:   FEP kinectRX

main.cpp

Committer:
skouki
Date:
2018-08-20
Revision:
0:e89966d8e5d9
Child:
1:393502eef76d

File content as of revision 0:e89966d8e5d9:

#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");
       }
    }
}