光幻广州塔,我看网上好多都不加外部驱动都能点亮,我做的灯不够亮度(p0和p1口接灯负极,p2p3口接正极)
#include
#define uchar unsigned char
#define uint unsigned int
uchar k;
table[lbk][rbk]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=5;b>0;b--);
}
void ceng()
{P1=0xff;
for(k=0;k<8;k++){P3=table[lbk]k[rbk];delay(200);}
}
void main()
{
while(1)
{
cengS();
}
}
#include
#define uchar unsigned char
#define uint unsigned int
uchar k;
table[lbk][rbk]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=5;b>0;b--);
}
void ceng()
{P1=0xff;
for(k=0;k<8;k++){P3=table[lbk]k[rbk];delay(200);}
}
void main()
{
while(1)
{
cengS();
}
}