基于stm32单片机智能浇花自动灌溉控制系统Proteus仿真+源码 | 您所在的位置:网站首页 › 基于STM32的智能浇花系统设计 › 基于stm32单片机智能浇花自动灌溉控制系统Proteus仿真+源码 |
资料编号:113 一:功能介绍 1、采用stm32单片机+LCD1602+DHT11温湿度传感器+按键+电机,制作一个智能浇花自动灌溉控制系统; 2、通过按键设置所需湿度阈值,LCD1602显示设置阈值; 3、通过DHT11温湿度读取当前的温湿度,并且LCD1602显示温湿度值,当检测湿度低于设置湿度阈值,自动打开电机进行抽水浇水加湿; 4、LCD1602显示检测到的温湿度和设置的湿度阈值; 二:仿真演示视频+程序简要讲解:(程序有中文注释,新手容易看懂) 三:设计软件介绍 本设计使用C语言编程设计,程序代码采用keil5编写,程序有中文注释,新手容易看懂,仿真采用Proteus软件进行仿真,演示视频使用的是Proteus8.9版本;资料包里有相关软件包,可自行下载安装。 四:程序打开方法 特别注意:下载资料包以后一定要先解压!!!(建议解压到桌面上,文件路径太深会导致程序打开异常),解压后再用keil5打开。 程序部分展示,有中文注释,新手容易看懂/*****************引脚配置********************/void GPIO_Configuration(void){ GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); //LCD1602 管脚 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8| GPIO_Pin_9| GPIO_Pin_10| GPIO_Pin_11| GPIO_Pin_12| GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 |GPIO_Pin_6|GPIO_Pin_5; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); //DHT11 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; GPIO_Init(GPIOB, &GPIO_InitStructure);}void IO_out( void ){ GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC ,ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0| GPIO_Pin_1| GPIO_Pin_2| GPIO_Pin_3; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10|GPIO_Pin_9|GPIO_Pin_8|GPIO_Pin_7; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); }void anjiansaomiao(void){ //值+ if(k1 == 1) { set1++; while(k1!=0); if(set1>100) set1=100; } //值- if(k2 == 1) { set1--; while(k2!=0); if(set1 |
CopyRight 2018-2019 实验室设备网 版权所有 |