Código simplificado, grados, funciona detencion filas, columna falta.

Dependencies:   mbed mbed

Fork of moggo by julian alvarez

Files at this revision

API Documentation at this revision

Comitter:
jiuk
Date:
Wed Sep 12 20:14:20 2018 +0000
Parent:
3:990a096b8120
Commit message:
Version funcional para ultima fila sin error

Changed in this revision

moggo.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/moggo.cpp	Wed Sep 12 18:10:17 2018 +0000
+++ b/moggo.cpp	Wed Sep 12 20:14:20 2018 +0000
@@ -53,7 +53,7 @@
         if(mat_act[i]==0)
         fila=i;
         if(mat_act[i]!=0){
-        fila=i-2;
+        fila=i-1;                                   //cambio de 2 a 1
         i=8;
         }
     }
@@ -76,21 +76,21 @@
 void guardar_mat(){
         //borrar();
         wait_ms(VEL);
-        mat_act[fila-1]=mat_tmp[0];
-        mat_act[fila]=mat_tmp[1];
-        mat_act[fila+1]=mat_tmp[2];
+        mat_act[fila-2]=mat_tmp[0];
+        mat_act[fila-1]=mat_tmp[1];     //pasa de 0 a -1
+        mat_act[fila]=mat_tmp[2];       //pasa de +1 a 0
     };
 
 
 void imp_mat(uint8_t *temp){
     uint8_t i=0;
     buscar_fil();
-    for (i=0;i<fila;i++){                      
+    for (i=0;i<=fila;i++){                      
     
         sendSPI(i-1,0);
-        sendSPI(i,*(temp+0));
-        sendSPI(i+1,*(temp+1));
-        sendSPI(i+2,*(temp+2));
+        sendSPI(i-1,*(temp+0));
+        sendSPI(i,*(temp+1));
+        sendSPI(i+1,*(temp+2));                     //pasa de i+2 a i+1
         wait_ms(VEL);
     }
 }