亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码

標題: 基于stm32單片機的智能家居系統程序 [打印本頁]

作者: 1504988397    時間: 2026-4-14 08:53
標題: 基于stm32單片機的智能家居系統程序
#include "total_wifi.h"
#include "pub_sub_message.h"
#include "DMA_adc.h"
#include "show.h"
#include "time4.h"
#include "usart3.h"
#include "infrared.h"
#include "dht11.h"
#include "motorrun.h"        
void data_caiji(void);
void ctrl_auto(void);
extern char SubcribePack_flag;   
unsigned int SystemTimer = 0;   
unsigned int TEHUTimer = 0;     
extern __IO uint16_t ADC_ConvertedValue[NOFCHANEL];

int Learn_IR_ctrl[5] = {0xFA, 0xFD, 0x01, 0x00, 0xDF};

int IR_ctrl_on[5] = {0xFA, 0xFD, 0x02, 0x00, 0xDF};
int IR_ctrl_off[5] = {0xFA, 0xFD, 0x02, 0x01, 0xDF };

u8 light, ppm, co;
u16 adc_light, adc_ppm, adc_co;
u8 tem, hum, people;
u8 PPM_MAX = 50, co_MAX = 50;
int main(void)
{
    Delay_Init();                  
    Usart1_Init(9600);              
    uart3_init(9600);

   
    KEY_Init();                     
    KEY_Exti_Init();
    ADCx_Init();
    OLED_Init();
    WiFi_ResetIO_Init();            
    AliIoT_Parameter_Init();            
    LED_Init();
    MOTOR_Init();
    DHT11_Init();
    TIM2_ENABLE_200MS();
    while(1)                     
    {



                                                data_caiji();




    }
}
u8 people_num_sta,people_num;
void data_caiji(void)
{
    if(IO_A5_IN_STA)
    {
                        printf("1");
                        people_num=1;               
                        if(people_num!=people_num_sta)
                        {
                                people_num_sta=people_num;
                                people++;
                        }
    }
                else
                {        printf("0");
                        people_num_sta=0;
                }
    adc_light = Get_Adc_Average(0, 10);
    if(adc_light > 4000)adc_light = 4000;
    light = (100 - (adc_light / 40));

   
    adc_ppm = Get_Adc_Average(1, 10);
    ppm = adc_ppm * 99 / 4096;
    ppm = ppm >= 99 ? 99 : ppm;
   
   
    adc_co = Get_Adc_Average(2, 10);
    co = adc_co * 99 / 4096;
    co = co >= 99 ? 99 : co;
   
    DHT11_Read_Data(&hum, &tem);
}
u8 auto_flag ;
u8 ppm_beep, ppm_beep_sta;
u8 co_beep, co_beep_sta;
void ctrl_auto(void)
{
    char temp[500];
    if(auto_flag)
    {
        if(ppm > PPM_MAX)
        {
            BEEP = !BEEP;
            ppm_beep = 1;
                                                Delay_Ms(30);
            if(ppm_beep != ppm_beep_sta)
            {
                show_num = 4;
                ppm_beep_sta = ppm_beep;
                if(SubcribePack_flag)
                {
                    sprintf(temp, "{\"method\":\"thing.event.property.post\",\"id\":\"203302322\",\"params\":{\""identifier10"\":1},\"version\":\"1.0.0\"}");
                    MQTT_PublishQs0(P_TOPIC_NAME, temp, strlen(temp));
                }
            }
        }
        else if(ppm < PPM_MAX)
        {
            BEEP = 1;
            ppm_beep = 0;
            if(ppm_beep != ppm_beep_sta)
            {
                show_num = 0;
                ppm_beep_sta = ppm_beep;
                if(SubcribePack_flag)
                {
                    sprintf(temp, "{\"method\":\"thing.event.property.post\",\"id\":\"203302322\",\"params\":{\""identifier10"\":0},\"version\":\"1.0.0\"}");
                    MQTT_PublishQs0(P_TOPIC_NAME, temp, strlen(temp));
                }
            }
        }
        if(co > co_MAX)
        {
            BEEP = !BEEP;
                                                Delay_Ms(30);
            co_beep = 1;
            show_num = 4;
            if(co_beep != co_beep_sta)
            {
                co_beep_sta = co_beep;
                if(SubcribePack_flag)
                {
                    sprintf(temp, "{\"method\":\"thing.event.property.post\",\"id\":\"203302322\",\"params\":{\""identifier11"\":1},\"version\":\"1.0.0\"}");
                    MQTT_PublishQs0(P_TOPIC_NAME, temp, strlen(temp));
                }
            }
        }
        else if(co < co_MAX)
        {
            BEEP = 1;
            co_beep = 0;
            if(co_beep != co_beep_sta)
            {
                show_num = 0;
                co_beep_sta = co_beep;
                if(SubcribePack_flag)
                {
                    sprintf(temp, "{\"method\":\"thing.event.property.post\",\"id\":\"203302322\",\"params\":{\""identifier11"\":0},\"version\":\"1.0.0\"}");
                    MQTT_PublishQs0(P_TOPIC_NAME, temp, strlen(temp));
                }
            }
        }
    }

}






歡迎光臨 (http://www.denmoz.com/bbs/) Powered by Discuz! X3.1