|
void main()
{
static uchar value;
Uart_Init();
chushihua_kz();
phone(phoneNumber);
init_1602(); //1602初始化
time_init(); //初始化定時器
// init_int0();
while(1)
{
if(flag_200ms == 1) //300ms 處理一次溫度程序
{
flag_200ms = 0;
value ++;
if(value >= 4)
{
value = 0;
if(miao != 0)
{
miao --; //時間減1
}
if(miao == 0)
flag_en = 0;
}
if(hw == 1) //感應(yīng)到人
{
miao = 30;
write_string(1,14,"Y ");
flag_en = 1;
}
else
write_string(1,14,"N ");
write_sfm2(1,0,miao);
temperature = read_temp(); //先讀出溫度的值
fengshan_kz(); //風(fēng)扇控制函數(shù)
write_sfm3_18B20(1,8,temperature);
if((flag_en == 1)&&(temperature >= t_high))
{
sendMessage(phoneNumber,msg);
}
}
}
}
|
|