Recepteur_SE

Dependencies:   mbed

Revision:
0:a839a51c5cec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 15 12:15:58 2019 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+
+Serial ant(D1, D0); //tx, rx
+Serial pc(D5,D4);
+char temp[8];
+int b_ok = 0;
+int main() {
+    pc.printf("AT$SF=%04x%04x\r\n",200,120);
+    while(1) {
+       // for(int i =0; i < 100; i++){
+            if(ant.readable())
+            {
+                ant.gets(temp,4);
+                for(int i =0; i < 4;i++){
+                    if(temp[i]=='b')
+                        b_ok=1;
+                }
+                if(b_ok==0){
+                   //pc.printf("AT$SF=%02x%02x\r\n",20,12);
+                   //wait(2);
+                   temp[0]='n';
+                   break;
+                }
+            }
+        //}
+        pc.printf("com : %c",temp[0]);
+        wait(0.5);
+        b_ok = 0;
+        //pc.printf(temp);
+    }
+}