51单片机心形流水灯源程序

admin 2019年02月10日 16:33:37 社会 0 0
用stc89c51单片机做的心形流水灯效果非常棒,下面是实物图:

背面:

本文引用地址:http://www.eepw.com.cn/article/201612/324694.htm

原理图我就不画了4个p口全部接上led灯即可,下面是控制程序:

#include

#include

#define uint unsigned int

#define uchar unsigned char

uchar code table0[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};//P0-P7依次点亮

uchar code table1[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff};//P0-P7依次熄灭

uchar code table2[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};//P7-P0依次点亮