基于51单片机的心形流水灯视频地址新手焊接、技术有限。振荡电路藏于单片机下。30个led灯并联未加电阻。供电采用移动电源内置的锂电池从生日蜡烛上拆下来的电路。共用一个开关。附源程序:C语言#includereg52.hunsignedintx,y;voiddelayms(unsignedintz)//延时程序{unsignedinti,j;for(i=z;i0;i--)for(j=110;j0;j--);}/*----------------------------------------------------------*/voidOffall()//开启所有灯{P0=0x00;P1=0x00;P2=0x00;P3=0x00;}/*----------------------------------------------------------*/voidOnall()//关闭所有灯{P0=0xff;P1=0xff;P2=0xff;P3=0xff;}/*----------------------------------------------------------*/voidls()//等时流水灯{P0=0x00;P0=0x01;delayms(50);P0=0x02;delayms(50);P0=0x04;delayms(50);P0=0x08;delayms(50);P0=0x10;delayms(50);P0=0x20;delayms(50);P0=0x40;delayms(50);P0=0x80;delayms(50);P0=0x00;P2=0x00;P2=0x80;delayms(50);P2=0x40;delayms(50);P2=0x20;delayms(50);P2=0x10;delayms(50);P2=0x08;delayms(50);P2=0x04;delayms(50);P2=0x02;delayms(50);P2=0x01;delayms(50);P2=0x00;P3=0x00;P3=0x80;delayms(50);P3=0x40;delayms(50);P3=0x20;delayms(50);P3=0x10;delayms(50);P3=0x08;delayms(50);P3=0x04;delayms(50);P3=0x02;delayms(50);P3=0x01;delayms(50);P3=0x00;P1=0x00;P1=0x80;delayms(50);P1=0x40;delayms(50);P1=0x20;delayms(50);P1=0x10;delayms(50);P1=0x08;delayms(50);P1=0x04;delayms(50);P1=0x02;delayms(50);P1=0x01;delayms(50);P1=0x00;P0=0x01;delayms(50);P0=0x00;}/*----------------------------------------------------------*/voidfxls()//反向等时流水灯{P0=0x00;P0=0x01;delayms(50);P0=0x00;P1=0x00;P1=0x01;delayms(50);P1=0x02;delayms(50);P1=0x04;delayms(50);P1=0x08;delayms(50);P1=0x10;delayms(50);P1=0x20;delayms(50);P1=0x40;delayms(50);P1=0x80;delayms(50);P1=0x00;P3=0x00;P3=0x01;delayms(50);P3=0x02;delayms(50);P3=0x04;delayms(50);P3=0x08;delayms(50);P3=0x10;delayms(50);P3=0x20;delayms(50);P3=0x40;delayms(50);P3=0x80;delayms(50);P3=0x00;P2=0x00;P2=0x01;delayms(50);P2=0x02;delayms(50);P2=0x04;delayms(50);P2=0x08;delayms(50);P2=0x10;delayms(50);P2=0x20;delayms(50);P2=0x40;delayms(50);P2=0x80;delayms(50);P2=0x00;P0=0x00;P0=0x80;delayms(50);P0=0x40;delayms(50);P0=0x20;delayms(50);P0=0x10;delayms(50);P0=0x08;delayms(50);P0=0x04;delayms(50);P0=0x02;delayms(50);P0=0x01;delayms(50);P0=0x00;}/*----------------------------------------------------------*/voidbsb()//半双边流水由上至下{Offall();P0=0x01;delayms(50);P0=0x02;P1=0x01;delayms(50);P0=0x04;P1=0x02;delayms(50);P0=0x08;P1=0x04;delayms(50);P0=0x10;P1=0x08;delayms(50);P0=0x20;P1=0x10;delayms(50);P0=0x40;P1=0x20;delayms(50);P0=0x80;P1=0x40;delayms(50);P0=0x00;P2=0x80;P1=0x80;delayms(50);P1=0x00;P2=0x40;P3=0x01;delayms(50);P2=0x20;P3=0x02;delayms(50);P2=0x10;P3=0x04;delayms(50);P2=0x08;P3=0x08;delayms(50);P2=0x04;P3=0x10;delayms(50);P2=0x02;P3=0x20;delayms(50);P2=0x01;P3=0x40;delayms(50);Offall();P3=0x80;delayms(50);Offall();}/*----------------------------------------------------------*/voidfbsb()//半双边流水由下至上{Offall();P3=0x80;delayms(50);P2=0x01;P3=0x40;delayms(50);P2=0x02;P3=0x20;delayms(50);P2=0x04;P3=0x10;delayms(50);P2=0x08;P3=0x08;delayms(50);P2=0x10;P3=0x04;delayms(50);P2=0x20;P3=0x02;delayms(50);P2=0x40;P3=0x01;delayms(50);Offall();P2=0x80;P1=80;delayms(50);Offall();P0=0x80;P1=0x40;delayms(50);P0=0x40;P1=0x20;delayms(50);P0=0x20;P1=0x10;delayms(50);P0=0x10;P1=0x08;delayms(50);P0=0x08;P1=0x04;delayms(50);P0=0x04;P1=0x02;delayms(50);P0=0x02;P1=0x01;delayms(50);Offall();P0=0x01;Offall();}voidzxsz()//正向生长{Offall();P0=0x01;delayms(50);P0=0x03;delayms(50);P0=0x07;delayms(50);P0=0x0f;delayms(50);P0=0x1f;delayms(50);P0=0x3f;delayms(50);P0=0x7f;delayms(50);P0=0xff;delayms(50);P2=0x80;delayms(50);P2=0xc0;delayms(50);P2=0xe0;delayms(50);P2=0xf0;delayms(50);P2=0xf8;delayms(50);P2=0xfc;delayms(50);P2=0xfe;delayms(50);P2=0xff;delayms(50);P3=0x80;delayms(50);P3=0xc0;delayms(50);P3=0xe0;delayms(50);P3=0xf0;delayms(50);P3=0xf8;delayms(50);P3=0xfc;delayms(50);P3=0xfe;delayms(50);P3=0xff;delayms(50);P1=0x80;delayms(50);P1=0xc0;delayms(50);P1=0xe0;delayms(50);P1=0xf0;delayms(50);P1=0xf8;delayms(50);P1=0xfc;delayms(50);P1=0xfe;delayms(50);P1=0xff;delayms(50);}/*----------------------------------------------------------*/voidfxsz()//反向生长{Offall();P0=0x01;delayms(50);P1=0x01;delayms(50);P1=0x03;delayms(50);P1=0x07;delayms(50);P1=0x0f;delayms(50);P1=0x1f;delayms(50);P1=0x3f;delayms(50);P1=0x7f;delayms(50);P1=0xff;delayms(50);P3=0x01;delayms(50);P3=0x03;delayms(50);P3=0x07;delayms(50);P3=0x0f;delayms(50);P3=0x1f;delayms(50);P3=0x3f;delayms(50);P3=0x7f;delayms(50);P3=0xff;delayms(50);P2=0x01;delayms(50);P2=0x03;delayms(50);P2=0x07;delayms(50);P2=0x0f;delayms(50);P2=0x1f;delayms(50);P2=0x3f;delayms(50);P2=0x7f;delayms(50);P2=0xff;delayms(50);P0=0x81;delayms(50);P0=0xc1;delayms(50);P0=0xe1;delayms(50);P0=0xf1;delayms(50);P0=0xf9;delayms(50);P0=0xfd;delayms(50);P0=0xff;delayms(50);}/*----------------------------------------------------------*/voidzxsw()//正向死亡{Onall();P0=0xfd;delayms(50);P0=0xf9;delayms(50);P0=0xf1;delayms(50);P0=0xf0;delayms(50);P0=0xe1;delayms(50);P0=0xc1;delayms(50);P0=0x81;delayms(50);P0=0x01;delayms(50);P2=0x7f;delayms(50);P2=0x3f;delayms(50);P2=0x1f;delayms(50);P2=0x0f;delayms