4x4x4光立方C程序Word下载.docx
《4x4x4光立方C程序Word下载.docx》由会员分享,可在线阅读,更多相关《4x4x4光立方C程序Word下载.docx(57页珍藏版)》请在冰豆网上搜索。
ssgong_yang30[]={0x00,0x00,0x08,0x88,0xc8,0xe8,0xf0,0x71,0x31,0x11,0x00,0x04,0x06,0x02};
ssgong_yang11[]={0x01,0x33,0x77,0xff,0xe0,0x00,0x00,0x08,0xcc,0xee,0xff,0x70,0x00,0x00};
ssgong_yang31[]={0x00,0x00,0x07,0xff,0xee,0xcc,0x80,0x00,0x00,0x0e,0xff,0x77,0x33,0x10};
ssgong_yang12[]={0x48,0x44,0x22,0x21,0x30,0xc0};
ssgong_yang32[]={0x12,0x22,0x44,0x84,0x0c,0x03};
ssgong_yang13[]={0x0f,0xf0,0x00,0x00};
ssgong_yang33[]={0x00,0x00,0x0f,0xf0};
/*********延时*********/
voiddelay(mmtime)
{mmi,j;
for(i=0;
i<
time;
i++)
for(j=0;
j<
250;
j++);
}
/*********第一种:
全亮并带有闪烁*********/
voiddisplay1()
{ssa,i;
i=10;
while(i--)
for(a=0;
a<
2;
a++)
{gong_yin1=di00[a];
gong_yin2=di00[a+2];
gong_yin3=di00[a+4];
gong_yin4=di00[a+6];
P1=0xff;
P3=0xff;
delay(350);
}
/*********第二种:
上下闪动*********/
voiddisplay2()
{ssb,g;
g=10;
while(g--)
for(b=0;
b<
4;
b++)
{gong_yin1=di01[b];
gong_yin2=di01[b+3];
gong_yin3=di01[b+2];
gong_yin4=di01[b+1];
/*********第三种:
从上到下旋转而下*********/
voiddisplay3()
{ssx,y;
for(x=0;
x<
x++)
{gong_yin1=di01[x];
gong_yin2=di01[x+3];
gong_yin3=di01[x+2];
gong_yin4=di01[x+1];
for(y=0;
y<
9;
y++)
{P1=gong_yang10[y];
P3=gong_yang30[y];
delay(350);
}
delay(250);
/*********第四种:
四面循环*********/
voiddisplay4()
{ssi,g;
g=5;
while(g--)
14;
{gong_yin1=0;
gong_yin2=0;
gong_yin3=0;
gong_yin4=0;
P1=gong_yang10[i];
P3=gong_yang30[i];
delay(200);
/*********第五种:
四角有内向外*********/
voiddisplay5()
{ssg;
g=20;
gong_yin4=0;
gong_yin2=1;
gong_yin3=1;
P1=0x09;
P3=0x90;
delay(450);
gong_yin2=0;
gong_yin3=0;
gong_yin1=1;
gong_yin4=1;
P1=0x60;
P3=0x06;
delay(450);
/*********第六种:
角对角*********/
voiddisplay6()
{ssk,g,i;
i=5;
{for(k=0;
k<
k++)
{gong_yin1=di10[k];
gong_yin2=di10[k+6];
gong_yin3=di10[k+5];
gong_yin4=di10[k+4];
P1=gong_yang11[k];
P3=gong_yang31[k];
for(g=13;
g>
0;
g--)
{
gong_yin1=di10[g+6];
gong_yin2=di10[g+5];
gong_yin3=di10[g+4];
gong_yin4=di10[g];
P1=gong_yang11[g];
P3=gong_yang31[g];
/*********第七种:
一竖排旋转*********/
voiddisplay7()
{sss,g;
for(s=0;
s<
6;
s++)
gong_yin1=0;
P1=gong_yang12[s];
P3=gong_yang32[s];
/*********第八种:
波浪前后左右*********/
voiddisplay8()
{ssa,b,c,d,e,f,g,h;
h=3;
while(h--)
{a=10;
while(a--)
{gong_yin1=0;
P1=0x0f;
P3=0x00;
delay(30);
b=10;
while(b--)
P1=0xf0;
delay(10);
c=10;
while(c--)
{gong_yin1=0;
P1=0x00;
P3=0x0f;
d=10;
while(d--)
P3=0xf0;
P1=0x00;
gong_yin3=1;
}
e=10;
while(e--)
f=10;
while(f--)
g=10;
while(g--)
delay(20);
}
voiddisplay9()
h=3;
P1=0xf0;
P1=0x0f;
}
voiddisplay10()
P1=0x88;
P3=0x88;
P1=0x44;
P3=0x44;
P1=0x22;
P3=0x22;
P1=0x11;
P3=0x11;
P1=0x22;
voiddisplay11()
P1=0x11;
P1=0x44;
P1=0x88;
gong_yi