標(biāo)題:
STC單片機(jī)做的呼吸燈源代碼
[打印本頁]
作者:
suifeng668
時(shí)間:
2017-11-17 08:57
標(biāo)題:
STC單片機(jī)做的呼吸燈源代碼
51單片機(jī)做的呼吸燈源代碼
單片機(jī)源程序如下:
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
//sbit LED0=P3^5;
//sbit LED1=P3^4;
//sbit LED2=P3^0;
//sbit LED3=P3^1;
//sbit LED4=P3^2;
//sbit LED5=P3^3;
uint cycle,high,low;
void delay(uint t)
{
while(t--);
}
void main()
{
cycle=700; //周期
while(1)
{
for(high=cycle-1;high>0;high--) //由亮變暗
{
P3=0xff;
delay(high);
P3=0x00;
low=cycle-high;
delay(low);
}
P3=0x00;
delay(60000);
for(high=1;high<cycle;high++)
{ //由暗變亮
P3=0xff;
delay(high);
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
STC呼吸燈.rar
(24.94 KB, 下載次數(shù): 57)
2017-11-17 08:56 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
dht179
時(shí)間:
2018-1-19 20:22
很實(shí)在的效果,代碼很簡潔。
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1