Takeuchi Issei / Mbed 2 deprecated Serial_Writer

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
e2011220
Date:
Thu May 20 15:43:34 2021 +0000
Parent:
6:ef64b02d2ff5
Commit message:
plastic2;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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