Piccolo

Dependencies:   mbed

Fork of 02_LAB_serial_protocol by ferney alberto beltran molina

Revision:
7:fab201aa45b7
Parent:
6:cb6b868465c3
Child:
8:38ae341e2a4f
--- a/main.cpp	Sat Sep 23 13:49:55 2017 +0000
+++ b/main.cpp	Sat Sep 23 14:44:47 2017 +0000
@@ -8,7 +8,7 @@
 //*****************************************************************************
 //  COMANDO  MOVER MOTOR
 //  |POS 1|POS 2|POS 3|POS 4| POS 5|
-//  |  <  | #C  | a | b | c  | d |  >   |
+//  |  <  | #C  | a   | b   |  >   |
 //
 // #C -> indica el comando
 // a,b,c,d parametros del comando
@@ -22,6 +22,16 @@
 #define INITPARAMETER  1
 
 
+// COMANDOS 
+#define LED_NC 0
+#define DOT_NC 1
+#define LINE_NC 2
+#define RECTANGLE_NC 3
+#define CICLE_NC 4
+#define HOME_NC 5
+
+
+
 uint8_t buffer_command[BUFF_SIZE]={0,0,0,0};
 
 
@@ -86,6 +96,48 @@
                 led=0;   
                  
 }
+void command_exe()
+{
+    
+switch (buffer_command[COMM_N]){
+
+case (LED_NC): command_led(buffer_command[INITPARAMETER]);
+break;
+case (DOT_NC):
+    #if DEBUG
+    command.printf("draw dot\n");
+    #endif
+
+break;
+
+case  LINE_NC:
+    #if DEBUG
+    command.printf("draw line\n");
+    #endif
+
+
+break;
+
+case RECTANGLE_NC: 
+    #if DEBUG
+    command.printf("draw rectabgle\n");
+    #endif
+
+
+break;
+
+default:
+
+    #if DEBUG
+    command.printf("comando  no encontrado\n");
+    #endif
+
+        
+}
+}
+
+
+
 int main() {
     #if DEBUG
     command.printf("inicio con debug\n");
@@ -98,7 +150,7 @@
         if (val== '<'){
             Read_command();
             if (check_command()){
-                command_led(buffer_command[INITPARAMETER]);
+                command_exe();
                 #if DEBUG
                  echo_command();
                 #endif