Communication device setting

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
umezawa
Date:
Tue Dec 29 06:32:30 2020 +0000
Commit message:
test

Changed in this revision

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
diff -r 000000000000 -r cddb9809247b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Dec 29 06:32:30 2020 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX);
+Serial com(D1,D0);
+DigitalOut NRST(A5);
+int i = 0;
+char msg[256];
+
+int main()
+{
+    com.baud(115200);
+    pc.baud(115200);
+    /*reset*/
+    pc.printf("reset\r\n");
+    NRST = 1;
+    NRST = 0;
+    wait(2);
+    NRST = 1;
+    /*Setting*/
+    com.scanf("%s",msg);//受信
+    pc.printf("%s\r\n",msg);
+    if (strstr(msg,"Select")!=NULL) {
+        com.printf("1\r\n");
+        pc.printf("Terminal mode\r\n");
+        com.printf("node\r\n");
+        wait(0.5);
+        pc.printf("node\r\n");
+        com.printf("1\r\n");
+        wait(0.5);
+        com.printf("ownid\r\n");
+        wait(0.5);
+        com.printf("0\r\n");
+        wait(0.5);
+        pc.printf("ownid\r\n");
+        com.printf("dstid\r\n");
+        wait(0.5);
+        com.printf("1\r\n");
+        wait(0.5);
+        pc.printf("dstid\r\n");
+        com.printf("q\r\n");
+        wait(0.5);
+        com.printf("2\r\n");
+        wait(0.5);
+        pc.printf("Operation\r\n");
+        com.printf("save\r\n");
+        wait(1.0);
+        com.printf("start\r\n");
+        wait(0.5);
+        pc.printf("Setting is finished\r\n");
+        com.printf("HEPTA\r\n");
+        }else
+        {
+            pc.printf("error\r\n");
+            }
+            
+}
\ No newline at end of file
diff -r 000000000000 -r cddb9809247b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 29 06:32:30 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file