藤田さんが教えてくれたコード.ボーレートを38400に設定しているのはマイコン側のIM920を受信にしているとき,19200だとうまく読み取れないから.コマンドはインタープランのサイトを参照

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
falconsyunya
Date:
Wed Aug 19 14:01:11 2020 +0000
Commit message:
2020/08/19

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Wed Aug 19 14:01:11 2020 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Aug 19 14:01:11 2020 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+int main()
+{
+    Serial pc(USBTX, USBRX,38400);//ボーレートを落とすと,USB側からのデータが正確に出力されない.
+    Serial uart(PA_9,PA_10,19200);//TX(IM920_RX), RX(IM920_TX)
+
+    DigitalOut pc_activity(LED1);
+    DigitalOut uart_activity(LED2);
+
+    while(1) {
+        if(pc.readable()) {
+            uart.putc(pc.getc());
+            pc_activity = !pc_activity;
+        }
+        if(uart.readable()) {
+            pc.putc(uart.getc());
+            uart_activity = !uart_activity;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Aug 19 14:01:11 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file