Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Metrix_slave by
Revision 1:c8c98a6d30f2, committed 2018-10-18
- Comitter:
- jiuk
- Date:
- Thu Oct 18 11:21:10 2018 +0000
- Parent:
- 0:c99f94d31799
- Commit message:
- Metrix_slave revision 1.0
Changed in this revision
| metrix_slave.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c99f94d31799 -r c8c98a6d30f2 metrix_slave.cpp
--- a/metrix_slave.cpp Thu Oct 18 02:13:29 2018 +0000
+++ b/metrix_slave.cpp Thu Oct 18 11:21:10 2018 +0000
@@ -14,7 +14,7 @@
uint8_t mat_act[11]={0,0,0,0,0,0,0,0,0,0,0}; //Matriz para mostrar en pantalla.
uint8_t mat_tmp[8]={0,0,0,0,0,0,0,0}; //Matriz temporal para arrojar las fichas.
uint8_t mat_tmp1[8]={0,0,0,0,0,0,0,0};
-uint8_t cont=0,ncolumna=1,grados=1,ficha=0;
+uint8_t cont=0,ncolumna=1,grados=1,ficha=0,metrix;
int fila=0;
void sendSPI(uint8_t d1, uint8_t d2)
@@ -101,6 +101,7 @@
uint8_t correr;
char t=1;
+ /*
while (t==1 && command.readable()==0){
wait_ms(0.1);
t=0;
@@ -110,8 +111,8 @@
//correr=command.getc();
else
correr=0;
-
- //correr=command.getc();
+ */
+ correr=com_tar.getc();
if(correr==30) //Arriba, voltear figura.
correr=1;
@@ -142,19 +143,22 @@
break; //Girar la figura;
case 2:
+ /*
if((mat_tmp[1]!=1) && (mat_tmp[2]!=1) && (mat_tmp[3]!=1)){
if((mat_tmp[1]!=3) && (mat_tmp[2]!=3) && (mat_tmp[3]!=3)){
if((mat_tmp[1]!=7) && (mat_tmp[2]!=7) && (mat_tmp[3]!=7))
ncolumna++;
}
}
+ */
+ ncolumna++;
break; //correr a la Derecha;
case 3:
ncolumna--;
- if(ncolumna<1)
- ncolumna=1;
+ //if(ncolumna<1)
+ //ncolumna=1;
break; //correr a la izquierda;
/*
case 4:
@@ -238,20 +242,44 @@
int main() {
test();
borrar();
-
+ metrix=0; //Espera el turno.
+ //com_tar.putc(metrix);
while(1){
- fichas();
- buscar_fil();
- cont=0;
+
+ if(metrix==0){
+ ficha=com_tar.getc();
+ grados=com_tar.getc();
+ ncolumna=com_tar.getc();
+ metrix=1;
+ }
+
+ if(metrix==1){
+ fichas();
+ buscar_fil();
+ cont=0;
+ // correr=command.getc(); //recibe el comando para orientar la ficha.
- while (cont<fila){
- correr_fig();
+ while (cont<fila){
+ correr_fig();
+ if(ncolumna>8){
+ metrix=0;
+ com_tar.putc(1);
+ com_tar.putc(grados);
+ com_tar.putc(cont);
+ }
+ if(ncolumna<1){
+ metrix=0;
+ com_tar.putc(8);
+ com_tar.putc(grados);
+ com_tar.putc(cont);
+ }
dibujar(ficha,grados,ncolumna);
buscar_fil();
imp_mat(mat_tmp);
wait_ms(VEL*2);
}
- guardar_mat();
- buscar_linea();
- }
- }
\ No newline at end of file
+ guardar_mat();
+ buscar_linea();
+ } //fin if
+ } //fin while
+ } //fin main
\ No newline at end of file
