juego 2 presentación

Dependencies:   mbed MPU6050

Revision:
7:5f1c8385cf8e
Parent:
6:4c9e8118c303
Child:
8:9c2dff610de9
--- a/recoge_manzanas.cpp	Thu Nov 22 09:57:49 2018 +0000
+++ b/recoge_manzanas.cpp	Thu Nov 22 10:38:28 2018 +0000
@@ -33,7 +33,58 @@
 bool _boton=0;
 void blink();
 void boton();
-void sendSPI();
+void sendSPI(uint8_t,uint8_t);
+
+
+//--------------------------------------------------
+//-------------------CARA_FELIZ------------------------
+//--------------------------------------------------  
+void cara_feliz()
+{
+    sendSPI(0x02,0b01100110);
+    wait(0.2);
+    sendSPI(0x03,0b01100110);
+    wait(0.2); 
+    sendSPI(0x06,0b01000010);   
+    wait(0.2);
+    sendSPI(0x07,0b00111100);
+    wait(0.2);
+        for(int i=0;i<4;i++)
+        {
+            sendSPI(0x06,0x00);
+            sendSPI(0x07,0b00111100); 
+            wait(0.2);   
+            sendSPI(0x07,0b00111100);   
+            wait(0.2);
+            sendSPI(0x06,0b01000010);
+            wait(0.2);
+        }   
+}
+
+//--------------------------------------------------
+//-------------------CARA_TRISTE------------------------
+//--------------------------------------------------  
+void cara_triste()
+{
+    sendSPI(0x02,0b01100110);
+    wait(0.2);
+    sendSPI(0x03,0b01100110);
+    wait(0.2); 
+    sendSPI(0x06,0b00111100);   
+    wait(0.2);
+    sendSPI(0x07,0b01000010);
+    wait(0.2);
+        for(int i=0;i<4;i++)
+        {
+            sendSPI(0x07,0x00);
+            sendSPI(0x06,0b00111100); 
+            wait(0.2);   
+            sendSPI(0x06,0b00111100);   
+            wait(0.2);
+            sendSPI(0x07,0b01000010);
+            wait(0.2);
+        }        
+}
 
 //--------------------------------------------------
 //-------------------TICKER------------------------
@@ -42,9 +93,9 @@
 {
     blink();
     boton();
-    if (command.readable())
+    if (com_tar.readable())
     {
-    //sendSPI(0x05,0xff);
+    cara_triste();
     command.printf("Button pressed %b\n", _boton);
     }
 }; 
@@ -339,7 +390,7 @@
                         {
                             com_tar.putc(1);
                             command.printf("Enviado");
-                            //mostrar_carita_feliz();
+                            cara_feliz();
                         }
                         x=1;
             }