abrayan

Dependencies:   mbed

Revision:
2:3007b3c06d2c
Parent:
1:526bdd5faa37
Child:
6:8d7f6fe73ed1
--- a/main.cpp	Tue Sep 04 02:15:49 2018 +0000
+++ b/main.cpp	Tue Sep 11 01:27:25 2018 +0000
@@ -1,14 +1,8 @@
 #include "mbed.h"
-
 #include "main.h"
 
-
-
-
 Serial command(USBTX, USBRX);
 
-
-
 int main() {
     init_servo();
     init_serial();
@@ -18,9 +12,14 @@
     while(1)
     {
         read_cc=read_command();
-        switch (read_cc) {
-            case  0x01: moving(); break;
-            default: debug_m("error de comando. \nSe espera  0xFEF0 o 0xFFF0 \n");break ;      
+        
+        switch (read_cc)
+        {
+            case  0x01: moving();
+                        break;
+                        
+            default:    debug_m("error de comando.\n");
+                        break ;      
         }
     }
 }
@@ -29,15 +28,11 @@
 
 uint32_t read_command()
 {
-   // retorna los byte recibidos concatenados en un entero, 
-   
-
-    
     char intc=command.getc();
     
-    while(intc != '<')
+    while(intc != 0xff)
         intc=command.getc();
-    return intc;
+    return command.getc();
 }
 
 
@@ -47,15 +42,14 @@
 }
 
 
-void moving(){
+void moving()
+{
     debug_m("se inicia el comado mover..\n");    
-    
     char nmotor=command.getc();
     char grados=command.getc();
     char endc=command.getc();
     mover_ser(nmotor,grados); 
-    debug_m("fin del comado guardar..\n");    
-    
+    debug_m("fin del comado guardar..\n");       
 }
 
 void debug_m(char *s , ... ){