Alyson Castiblanco
/
00_01LAB_matrix8x8_fig_tetris
ok
Fork of 00_01LAB_matrix8x8_fig_tetris by
Diff: main.cpp
- Revision:
- 2:414129d953dd
- Parent:
- 1:b732136485e0
- Child:
- 3:4a8de2f71ed0
--- a/main.cpp Wed Mar 15 21:47:38 2017 +0000 +++ b/main.cpp Thu Mar 16 22:53:10 2017 +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}; void sendSPI(uint8_t d1, uint8_t d2) @@ -32,17 +32,56 @@ } }; + +void reset_vcol() + { + for (i=0; i<8;i++){ + vcol2[i]=0; + } +} + +void print_Snake2() +{ + + int j, i; + //reset + reset_vcol(); + for (j=0; j<8;j++){ + for (i=0; i<8;i++){ + if(j % 2 == 0){ + if (vcol2[j]==0) + vcol2[j]= 1; + vcol2[j]=3>>i; + } + else{ + if (vcol2[j]==0x80) + vcol2[j]= 1; + vcol2[j]=3>>i; + } + printMatrix(vcol2); + wait_ms(5); + } + } +} + void print_Snake() { - //reset - uint8_t vcol2[8]={0,0,0,0,0,0,0,0}; - uint8_t vcol[8]={0,1,3,7,0xf,0x1f,0x3f,}; + + uint8_t vt1[8]={1,3,7,0xf,0x1f,0x3f, 0x7f,0xff}; + uint8_t vt2[8]={0b10000000,0b11000000,0b11100000,0b11110000,0b11111000,0b11111100,0b11111110,0b11111111}; + int j, i; + //reset + reset_vcol(); for (j=0; j<8;j++){ for (i=0; i<8;i++){ - vcol2[j]=i; + if(j % 2 == 0){ + vcol2[j]=vt1[i]; + }else{ + vcol2[j]=vt2[i]; + } printMatrix(vcol2); wait_ms(5); }