Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@0:c5c02975ae0c, 2020-12-11 (annotated)
- Committer:
- ryouheitakamoto
- Date:
- Fri Dec 11 08:24:02 2020 +0000
- Revision:
- 0:c5c02975ae0c
- Child:
- 1:fec69401b978
xyz
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryouheitakamoto | 0:c5c02975ae0c | 1 | #include "mbed.h" |
ryouheitakamoto | 0:c5c02975ae0c | 2 | |
ryouheitakamoto | 0:c5c02975ae0c | 3 | Serial pc(SERIAL_TX, SERIAL_RX); |
ryouheitakamoto | 0:c5c02975ae0c | 4 | Serial device(PA_9,PA_10); |
ryouheitakamoto | 0:c5c02975ae0c | 5 | |
ryouheitakamoto | 0:c5c02975ae0c | 6 | void doppler(){ |
ryouheitakamoto | 0:c5c02975ae0c | 7 | while(1){ |
ryouheitakamoto | 0:c5c02975ae0c | 8 | char c = device.getc(); |
ryouheitakamoto | 0:c5c02975ae0c | 9 | if(c == 0xfd){ |
ryouheitakamoto | 0:c5c02975ae0c | 10 | break; |
ryouheitakamoto | 0:c5c02975ae0c | 11 | } |
ryouheitakamoto | 0:c5c02975ae0c | 12 | else{ |
ryouheitakamoto | 0:c5c02975ae0c | 13 | printf("%02hhx ",c); |
ryouheitakamoto | 0:c5c02975ae0c | 14 | } |
ryouheitakamoto | 0:c5c02975ae0c | 15 | } |
ryouheitakamoto | 0:c5c02975ae0c | 16 | } |
ryouheitakamoto | 0:c5c02975ae0c | 17 | |
ryouheitakamoto | 0:c5c02975ae0c | 18 | int main() |
ryouheitakamoto | 0:c5c02975ae0c | 19 | { |
ryouheitakamoto | 0:c5c02975ae0c | 20 | device.baud(9600); |
ryouheitakamoto | 0:c5c02975ae0c | 21 | pc.baud(921600); |
ryouheitakamoto | 0:c5c02975ae0c | 22 | while(1) { |
ryouheitakamoto | 0:c5c02975ae0c | 23 | char c = device.getc(); |
ryouheitakamoto | 0:c5c02975ae0c | 24 | |
ryouheitakamoto | 0:c5c02975ae0c | 25 | if(c == 0xfe) { |
ryouheitakamoto | 0:c5c02975ae0c | 26 | //pc.printf("%02hhx ",c); |
ryouheitakamoto | 0:c5c02975ae0c | 27 | while(1) { |
ryouheitakamoto | 0:c5c02975ae0c | 28 | c = device.getc(); |
ryouheitakamoto | 0:c5c02975ae0c | 29 | if(c == 0x00){ |
ryouheitakamoto | 0:c5c02975ae0c | 30 | //pc.printf("%02hhx\r\n ",c); |
ryouheitakamoto | 0:c5c02975ae0c | 31 | doppler(); |
ryouheitakamoto | 0:c5c02975ae0c | 32 | printf("\r\n"); |
ryouheitakamoto | 0:c5c02975ae0c | 33 | break; |
ryouheitakamoto | 0:c5c02975ae0c | 34 | } |
ryouheitakamoto | 0:c5c02975ae0c | 35 | else{ |
ryouheitakamoto | 0:c5c02975ae0c | 36 | //pc.printf("%02hhx ",c); |
ryouheitakamoto | 0:c5c02975ae0c | 37 | |
ryouheitakamoto | 0:c5c02975ae0c | 38 | } |
ryouheitakamoto | 0:c5c02975ae0c | 39 | } |
ryouheitakamoto | 0:c5c02975ae0c | 40 | } |
ryouheitakamoto | 0:c5c02975ae0c | 41 | } |
ryouheitakamoto | 0:c5c02975ae0c | 42 | } |
ryouheitakamoto | 0:c5c02975ae0c | 43 | |
ryouheitakamoto | 0:c5c02975ae0c | 44 | |
ryouheitakamoto | 0:c5c02975ae0c | 45 |