projet neotim mpp / Mbed 2 deprecated 5-readserial

Dependencies:   mbed

Revision:
0:092cef4ad794
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 04 12:48:13 2020 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "string.h"
+Serial pc(USBTX, USBRX,19200); // tx, rx sur les broches associées au bus USB
+int err;
+char command[9];
+int main(void)
+{
+    while(1)
+    {
+        if (pc.readable()){
+            
+            err=pc.scanf("%s",command);
+            printf("la commande est : %s \n",command);
+           
+            if(strcmp(command,"marche")==0) {
+                printf("en avant!!!\n");
+                }
+            
+            if (strcmp(command,"arret")==0){
+                printf("STOP!!!");
+                }
+            }
+            
+    }
+}
+