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:
- KINU
- Date:
- 2020-12-09
- Revision:
- 1:f7f1c0356ffd
- Parent:
- 0:303ad425d2ac
- Child:
- 2:f510a0b084ba
File content as of revision 1:f7f1c0356ffd:
#include "mbed.h"
Serial pc(SERIAL_TX, SERIAL_RX);
Serial device(PA_9,PA_10);
DigitalIn dir(PA_10);
int main()
{
int bin;
int data[100000];
while(1) {
if(dir) { //データが届いている場合
bin = device.getc(); //bin変数に値を入れる
pc.printf("%02hhx ",bin); // デバッグ用
if(bin == 0xFE){// bin変数の中身がFEの場合、値の取得開始
pc.printf("start");
for(int k = 0; k<1000; k++){
data[k] == pc.getc(); //データをdata配列に入れる
pc.printf("%02hhx ",data[k]); // デバッグ用
if(data[k] == 0xFD)//データが配列の値がFDだった場合
printf("finish");
}
}
}
}
}
// printf("n = %x n = %X\n", n, n);これでnが16進表記になる