• 基于stm32的光照强度检测智能窗帘系统


    资料编号:098  下面是相关功能视频演示:

    98-基于stm32的光照强度检测智能窗帘系统Proteus仿真(源码+仿真+全套资料)

    功能介绍:

    检测当前的光照强度,LCD1602显示,并且可以自动打开关闭窗帘,也可以通过手动按键打开关闭窗帘,全套资料齐全,程序采用C语言,仿真采用Proteus,程序有中文注释,更容易理解;

    下面是程序部分展示:

    void LED_Init(void)
    {
     
     GPIO_InitTypeDef  GPIO_InitStructure;
         
     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);     //使能P端口时钟
        
     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;                 //LED0 端口配置
     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;          //推挽输出
     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
     GPIO_Init(GPIOA, &GPIO_InitStructure);
     GPIO_SetBits(GPIOA,GPIO_Pin_3);                         //输出高


    }
    void KEY_Init(void)
    {
        GPIO_InitTypeDef GPIO_InitStructure; //定义结构体变量    
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
        
        
        GPIO_InitStructure.GPIO_Pin=GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10;
        GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPU;    //上拉输入
        GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
        GPIO_Init(GPIOA,&GPIO_InitStructure);
    }
    int main(void)
    {
    int a,b,c,d;
        float temp;
        
        delay_init();             //延时函数初始化          
        LCD1602_Init();
      ADC1_GPIO_Config();
      ADC_Config();  
        LCD1602_ShowStr(1,0,"LIGHT=00 Lux",14);
        LED_Init();
        KEY_Init();    
        while(1)
        {
        b=ADC_GetConversionValue(ADC1);
        temp=(float)b*(3.4/4096);
        a=temp/1;
        c=temp*10;
        d=c%10;
        LCD_ShowNum(7,0,a);
        LCD_ShowNum(8,0,d);
            if(KEY3==0)
            {
            if(temp>2) LED=1;
            else LED=0;
            }
            else
            {
            if(KEY1==0) LED=1;

            if(KEY2==0) LED=0;
            }
            delay_ms(200);

        }
    }

     下面是该资料的分享下载链接:

    https://pan.baidu.com/s/1BKNQAD2wsI5ldR-Ybl8q6Q?pwd=tf6u

  • 相关阅读:
    python 获取上个月时间
    调研280+篇文献!CVPR最佳论文得主清华黄高团队提出首篇动态网络综述,全面回顾动态网络的发展!
    外中断的应用
    【C++】多态/虚函数/虚表指针,虚表
    Qt多线程之QThreadData::current()理解
    Python高级_第5章_Python高级语法与正则表达式
    学会这些VRay渲染器HDRI照明技巧,轻松搞定3ds Max
    java 正则表达式解析数据
    LabVIEW中图像显示错误
    MySQL数据库下载与安装使用
  • 原文地址:https://blog.csdn.net/m0_74295839/article/details/127943655