//2-dimensional array of row pin numbers:
int R[] = {2,7,A5,5,13,A4,12,A2};
// 2-dimensional array of column pin numbers:
int C[] = {6,11,10,3,A3,4,8,9};
// *include("Display");
unsigned char firststage[8][8] =
{ 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, };
//delay(1000);
unsigned char secondstage[8][8] =
{ 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,1,0,0,1,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,1,0,0,1,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, };
//delay(1000);
//};
unsigned char thirdstage[8][8] =
{
0,0,0,0,0,0,0,0,
0,1,0,0,0,0,1,0,
0,0,1,0,0,1,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,1,0,0,1,0,0,
0,1,0,0,0,0,1,0,
0,0,0,0,0,0,0,0, };
//delay(1000);
unsigned char fourthstage[8][8] =
{
1,0,0,0,0,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,0,0,1,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,1,0,0,1,0,0,
0,1,0,0,0,0,1,0,
1,0,0,0,0,0,0,1,
};
unsigned char fifthstage[8][8] =
{
1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1, };
//delay(1000);
unsigned char sixthstage[8][8] =
{
0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0, };
//delay(1000);
unsigned char seventhstage[8][8] =
{
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, };
//delay(1000);
unsigned char eigthstage[8][8] =
{
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, };
//delay(1000);
void setup()
{
// iterate over the pins:
for(int i = 0;i<8;i++)
// initialize the output pins:
{
pinMode(R[i],OUTPUT);
pinMode(C[i],OUTPUT);
}
}
void loop()
{
for(int i = 0 ; i < 100 ; i++) //Loop display 100 times
{
Display(firststage); //Display the "Big Heart"
}
//delay(4000);
//delay(3000);
for(int i = 0 ; i < 100 ; i++) //Loop display 50 times
{
Display(secondstage); //Display the "small Heart"
}
for(int i = 0 ; i < 100 ; i++)
{
Display(thirdstage);
}
for(int i = 0 ; i < 100 ; i++)
{
Display(fourthstage);
}
for(int i = 0 ; i < 100 ; i++)
{
Display(fifthstage);
}
for(int i = 0 ; i < 10 ; i++)
{
Display(sixthstage);
}
for(int i = 0 ; i < 10 ; i++)
{
Display(fifthstage);
}
//for(int i = 0 ; i < 10 ; i++) {
+display.sixthstage;
}
//for(int i = 0 ; i < 10 ; i++)
//{
/*Display(seventhstage);
}for(int i = 0 ; i < 10 ; i++)
{
Display(eigthstage);
}
for(int i = 0 ; i < 10 ; i++)
{
Display(seventhstage);
}for(int i = 0 ; i < 10 ; i++)
{
Display(eigthstage);
}for(int i = 0 ; i < 10 ; i++)
{
Display(seventhstage);
}for(int i = 0 ; i < 100 ; i++)
{
Display(eigthstage);
}
*/
}
void Display(unsigned char dat[8][8])
{
for(int c = 0; c<8;c++)
{
digitalWrite(C[c],LOW);//use thr column
//loop
for(int r = 0;r<8;r++)
{
digitalWrite(R[r],dat[r][c]);
}
delay(1);
Clear(); //Remove empty display light
}
}
void Clear() //清空显示
{
for(int i = 0;i<8;i++)
{
digitalWrite(R[i],LOW);
digitalWrite(C[i],HIGH);
} }