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
- Committer:
- ryouheitakamoto
- Date:
- 2020-12-16
- Revision:
- 3:61e7dda0c14d
- Parent:
- 2:43801dc371d0
- Child:
- 4:6e9a233c748d
File content as of revision 3:61e7dda0c14d:
#include "mbed.h" /*ドップラーシフト対策 calsatが計算した周波数のデータを受け取る*/ Serial pc(SERIAL_TX, SERIAL_RX); Serial device(PA_9,PA_10); void doppler() //データを取得し、出力する関数 { int data[10] = {0}; int flag = 0; while(1) { char c = device.getc(); if(c == 0x00) ; if(c == 0xfd) { //FD(終了コマンドがきたら終了 for(int i = 0; i < flag; i++) printf("%d ", data[i]); break; } else{ printf("%02hhx ",c); data[flag] = (c >> 4)&0xf; data[flag + 1] = c&0xf; flag += 2; } } } int main() { device.baud(9600); pc.baud(921600); while(1) { char c = device.getc(); if(c == 0xfe) { //FEコマンドがきたらdataが始まる while(1) { c = device.getc(); if(c == 0x00) { //サブコマンドがきたらデータ部分を読み取り始める doppler(); printf("\r\n"); break; } } } } }