void main()
{
static uchar value;
Uart_Init();
chushihua_kz(); //初始化SIM800C模块
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) //感应到人
{
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(); //风扇控制函数
write_sfm3_18B20(1,8,temperature);
if((flag_en == 1)&&(temperature >= t_high))
{
sendMessage(phoneNumber,msg); //发送信息
}
}
}
}
|