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

105-基于stm32单片机的智能恒温自动加氧换水鱼缸Proteus仿真(源码+仿真+全套资料)

功能讲解:采用stm32单片机,ds18b20测量温度,LCD1602显示温度,可以程序设置温度上下限值,当温度高于上限制,自动制冷,当温度低于最小值,自动加热,使系统保持一个恒温状态,可以通过按键使鱼缸进行加氧和换水的功能。

下面是部分程序展示:

LED_Init();               //初始化IO口
KEY_Init();KEY1=KEY2=1;
while(1)
    {    
    tem=DS18B20_Get_Temp();//读取温度
        if(    tem>0)             //温度为正
        {    a=tem/100;
        b=tem%100/10;
        c=tem%10;
        LCD_ShowChar(8,0,'+');
    LCD_ShowNum(9,0,a);    
    LCD_ShowNum(10,0,b);
    LCD_ShowNum(12,0,c);
    if(tem>100)  //设置比较值,100是指10.0℃
    {
    GPIO_ResetBits(GPIOA,GPIO_Pin_1);    //输出0
    GPIO_ResetBits(GPIOA,GPIO_Pin_2);    //输出0
    }
    else
    {
    GPIO_SetBits(GPIOA,GPIO_Pin_1);    //输出1
    GPIO_SetBits(GPIOA,GPIO_Pin_2);    //输出1
    }
    
    if(tem<50)  //设置比较值,50是指5.0℃
    {
    GPIO_ResetBits(GPIOA,GPIO_Pin_3);    //输出0
    GPIO_ResetBits(GPIOA,GPIO_Pin_4);    //输出0
    }
    else
    {
    GPIO_SetBits(GPIOA,GPIO_Pin_3);    //输出1
    GPIO_SetBits(GPIOA,GPIO_Pin_4);    //输出1
    }
        }
    else                            //温度为负
    {    
//        tem1=(int)tem;
//        tem1=abs(tem1);
        tem1=-(tem);
        tem1=tem1+1;
        a=tem1/100;
        b=tem1%100/10;
        c=tem1%10;
    LCD_ShowChar(8,0,'-');
    LCD_ShowNum(9,0,a);    
    LCD_ShowNum(10,0,b);
    LCD_ShowNum(12,0,c);
        
    }
    Delay_DS18B20(100000);
    if(KEY1==0)     GPIO_ResetBits(GPIOA,GPIO_Pin_5);
    else         GPIO_SetBits(GPIOA,GPIO_Pin_5);
    if(KEY2==0)     GPIO_ResetBits(GPIOA,GPIO_Pin_6);
    else         GPIO_SetBits(GPIOA,GPIO_Pin_6);
  } 

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

 https://pan.baidu.com/s/1DaEkd9VM8Jp5oMN-dl1geA?pwd=f1ar

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐