NagaokaRoboticsClub_mbedTeam
/
mbed-os-RX-test
ver1
main.cpp@0:e89966d8e5d9, 2018-08-20 (annotated)
- Committer:
- skouki
- Date:
- Mon Aug 20 06:28:55 2018 +0000
- Revision:
- 0:e89966d8e5d9
- Child:
- 1:393502eef76d
kinet???
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
skouki | 0:e89966d8e5d9 | 1 | #include "mbed.h" |
skouki | 0:e89966d8e5d9 | 2 | #include "FEP.h" |
skouki | 0:e89966d8e5d9 | 3 | #include "cstdint" |
skouki | 0:e89966d8e5d9 | 4 | |
skouki | 0:e89966d8e5d9 | 5 | FEP fep(PA_0,PA_1,211); |
skouki | 0:e89966d8e5d9 | 6 | Serial pc(USBTX,USBRX,115200); |
skouki | 0:e89966d8e5d9 | 7 | |
skouki | 0:e89966d8e5d9 | 8 | int main() |
skouki | 0:e89966d8e5d9 | 9 | { |
skouki | 0:e89966d8e5d9 | 10 | char data[256]; |
skouki | 0:e89966d8e5d9 | 11 | uint8_t temp,len; |
skouki | 0:e89966d8e5d9 | 12 | while(1) { |
skouki | 0:e89966d8e5d9 | 13 | len = 5; |
skouki | 0:e89966d8e5d9 | 14 | temp = fep.read(data,len); |
skouki | 0:e89966d8e5d9 | 15 | if(temp == 0) { |
skouki | 0:e89966d8e5d9 | 16 | pc.printf("recieved\r\n"); |
skouki | 0:e89966d8e5d9 | 17 | pc.printf("%d--%d\r\n",data[0]*1000+data[1]*100+data[2]*10+data[3],data[4]); |
skouki | 0:e89966d8e5d9 | 18 | } else if(temp == 1) { |
skouki | 0:e89966d8e5d9 | 19 | pc.printf("recieved data error\r\n"); |
skouki | 0:e89966d8e5d9 | 20 | } else if(temp == FEP_DT_ERR) { |
skouki | 0:e89966d8e5d9 | 21 | pc.printf("program or recieve error\r\n"); |
skouki | 0:e89966d8e5d9 | 22 | } else if(temp == FEP_DT_BIN) { |
skouki | 0:e89966d8e5d9 | 23 | pc.printf("transmitter is binary mode\r\n"); |
skouki | 0:e89966d8e5d9 | 24 | } else { |
skouki | 0:e89966d8e5d9 | 25 | pc.printf("No response\r\n"); |
skouki | 0:e89966d8e5d9 | 26 | } |
skouki | 0:e89966d8e5d9 | 27 | } |
skouki | 0:e89966d8e5d9 | 28 | } |