新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > 远程同步灯灯光效果子程序

远程同步灯灯光效果子程序

作者:时间:2012-08-25来源:网络收藏

前面一篇文章里我们介绍了单片机的电路和主程序,地址:http://www.51hei.com/mcu/1171.html,根据大家都要求我把也在此公开,大家在制作的过程中遇到什么问题可在本文评论中提出,我会尽量为大家解决。

void zhuizhu(void){uchar i;for(i=0;i8;i++){P0=zhui;delay();}for(i=0;i8;i++){   if(i+812)P0=zhui;P1=zhui;delay();}for(i=0;i13;i++){   if(i+812)P1=zhui;P2=zhui;delay();}P2=0x00;}void liushui(void){uchar i,j,k; P0=0x00;P1=0x00;P2=0x00;delay();for(i=0;i8;i++){   P0|=SET(i);  delay();}for(j=0;j8;j++){   P1|=SET(j);  delay();}for(k=0;k8;k++){   P2|=SET(k);  delay();}for(k=0;k8;k++){   P2=CLR_TO_R(k);  delay();}for(j=0;j8;j++){   P1=CLR_TO_R(j);  delay();}for(i=0;i8;i++){   P0=CLR_TO_R(i);  delay();}}void RGBjianbian(void){uchar x;uchar i,j;//=================红灯渐亮又渐暗 for(x=0;xLOG;x++){ for(i=0;iLOG;i++){P0=0x49;P1=0x92;P2=0x24;}for(j=0;jLOG-x;j++){   P0=0x00;P1=0x00;P2=0x00;}}               //灯从不亮到最亮   P36=1;for(x=0;xLOG;x++){ for(i=0;iLOG;i++){   P0=0x00;P1=0x00;P2=0x00;}for(j=0;jLOG-x;j++){P0=0x49;P1=0x92;P2=0x24;}}                  //从最亮又到暗  P0=0x00;P1=0x00;P2=0x00; //================================//================绿灯渐亮又渐暗 for(x=0;xLOG;x++){ for(i=0;iLOG;i++){P0=0x92;P1=0x24;P2=0x49;}for(j=0;jLOG-x;j++){   P0=0x00;P1=0x00;P2=0x00;}}               //灯从不亮到最亮   for(x=0;xLOG;x++){ for(i=0;iLOG;i++){   P0=0x00;P1=0x00;P2=0x00;}for(j=0;jLOG-x;j++){P0=0x92;P1=0x24;P2=0x49;}}//==============蓝灯变化 P0=0x00;P1=0x00;P2=0x00; for(x=0;xLOG;x++){ for(i=0;iLOG;i++){P0=0x24;P1=0x49;P2=0x92;}for(j=0;jLOG-x;j++){   P0=0x00;P1=0x00;P2=0x00;}}               //灯从不亮到最亮   for(x=0;xLOG;x++){ for(i=0;iLOG;i++){   P0=0x00;P1=0x00;P2=0x00;}for(j=0;jLOG-x;j++){P0=0x24;P1=0x49;P2=0x92;}}P0=0x00;P1=0x00;P2=0x00; }void  shanshuo(void) {P0=0x0f;P1=0x0f;P2=0x0f;delay2();P0=0x00;P1=0x00;P2=0x00;delay2();P0=0xf0;P1=0xf0;P2=0xf0;delay2();P0=0x00;P1=0x00;P2=0x00;delay2();}void delay2(void){uchar i,j,k;for(i=0;i50;i++)for(j=0;j80;j++)for(k=0;k100;k++);}void kaolong(void){P0=0x00;P1=0x00;P2=0x00;P0=0x11;P1=0x81;P2=0x88;delay2();P0=0x22;P1=0x42;P2=0x44;delay2();P0=0x44;P1=0x24;P2=0x22;delay2();P0=0x88;P1=0x18;P2=0x11;delay2();}void liushui2(void){P0=0x00;P1=0x00;P2=0x00;P0=0x01;delay();P0=0x08;delay();P0=0x40;delay();P0=0x00;P1=0x02;delay();P1=0x10;delay();P1=0x80;delay();P1=0x00;P2=0x04;delay();P2=0x20;delay();P2=0x00;  //===================red P0=0x02;delay();P0=0x010;delay();P0=0x80;delay();P0=0x00;P1=0x04;delay();P1=0x20;delay();P1=0x00;P2=0x01;delay();P2=0x08;delay();P2=0x40;delay();P2=0x00;   //===================greenP0=0x04;delay();P0=0x20;delay();P0=0x00;P1=0x01;delay();P1=0x08;delay();P1=0x40;delay();P1=0x00;P2=0x02;delay();P2=0x10;delay();P2=0x80;delay();P2=0x00;  //======================blue } 


评论


相关推荐

技术专区

关闭