cristhian david santos oggonei
/
matriz_max
cualquier cosa
Fork of 00_LAB_matrix8x8_SPI by
Diff: main.cpp
- Revision:
- 6:9ef1d33ed469
- Parent:
- 3:4a8de2f71ed0
diff -r 4a8de2f71ed0 -r 9ef1d33ed469 main.cpp --- a/main.cpp Thu Mar 16 22:56:47 2017 +0000 +++ b/main.cpp Tue Sep 04 21:09:27 2018 +0000 @@ -9,7 +9,7 @@ DigitalOut ssel (PB_12); #define uint8_t unsigned char -uint8_t vcol2[8]={0,0,0,0,0,0,0,0}; +uint8_t dat_matrix[8]={0,0,0,0,0,0,0,0}; void sendSPI(uint8_t d1, uint8_t d2) @@ -28,7 +28,7 @@ { uint8_t i =0; for (i=1;i<9;i++){ - sendSPI(i,*(vC+i)); + sendSPI(i,*(vC+i-1)); } }; @@ -36,7 +36,7 @@ void clr_vcol() { for (int i=0; i<8;i++){ - vcol2[i]=0; + dat_matrix[i]=0; } } @@ -50,19 +50,19 @@ for (j=0; j<8;j++){ clr_vcol(); if(j % 2 == 0) - vcol2[j]=1; + dat_matrix[j]=1; else - vcol2[j]=0b10000000; + dat_matrix[j]=0b10000000; for (i=0; i<8;i++){ if(j % 2 == 0){ - vcol2[j]=3<<i; + dat_matrix[j]=3<<i; } else{ - vcol2[j]=0b1100000000>>i; + dat_matrix[j]=0b1100000000>>i; } - printMatrix(vcol2); - wait_ms(5); + printMatrix(dat_matrix); + wait_ms(50); } } } @@ -80,25 +80,28 @@ for (j=0; j<8;j++){ for (i=0; i<8;i++){ if(j % 2 == 0){ - vcol2[j]=vt1[i]; + dat_matrix[j]=vt1[i]; }else{ - vcol2[j]=vt2[i]; + dat_matrix[j]=vt2[i]; } - printMatrix(vcol2); - wait_ms(5); + printMatrix(dat_matrix); + wait_ms(50); } } } int main() { uint8_t vcol[8]={0,0,0,0,0,0,0,0}; sendSPI(0x0c,1); + sendSPI(0x0b,7); sendSPI(0x0F,1); - wait (0.1); + wait (0.9); sendSPI(0x0f,0); - wait (0.1); + + wait (0.9); int i =0; while(1){ print_Snake(); + print_Snake2(); } } // ***************************************************************************