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.
Diff: main.cpp
- Revision:
- 7:f8369dfbf022
- Parent:
- 6:ef64b02d2ff5
diff -r ef64b02d2ff5 -r f8369dfbf022 main.cpp
--- a/main.cpp Thu May 20 15:23:17 2021 +0000
+++ b/main.cpp Thu May 20 15:43:34 2021 +0000
@@ -1,10 +1,14 @@
#include "Serial_Writer.h"
-Serial_Writer TWE(D5,D4,115200);
+Serial_Writer TWE(D5,D4,115200);//Serial_Writer オブジェクト名(TxPin RxPin baudrate); シリアル通信に用いるピンとbaudrateの設定
int main(void)
{
+ //オブジェクト名.attach(関数名); 受信割り込み
while(true) {
- char consts[3]={'A','B','C'};
- TWE.write(consts);
- wait_ms(5);
+ char consts[3]={'A','B','C'};//送信側と受信側の型、配列数を一致させてください
+ TWE.write(consts);//オブジェクト名.write(送る配列); 送信
+ wait_ms(5);//データの品質を保つため送信側に適度な待ち時間を入れてください
+
+ //int n=オブジェクト名.receive(受信する配列); 正しくデータが配列に入っている時戻り値が0になります
+ //int l=0オブジェクト名.readable(); 受信データがあるとき戻り値が1になります(受信割り込みが使えるマイコンの場合受信割り込みを使ったほうが良いです)
}
}
\ No newline at end of file