其他分享
首页 > 其他分享> > 基于STM32温湿度传感器采集报警系统设计(含超声波测距)

基于STM32温湿度传感器采集报警系统设计(含超声波测距)

作者:互联网

这次的设计主要是通过读取DHT11和HCSR04的数值,(Proteus的传感器貌似这两款好用一点)把读取的DHT11和HCSR04数值通过转化在lcd1602中显示出来,还有就是可以设置通过按键设置DHT11的温湿度阈值。

仿真原理图如下

运行结果图:

按下K1,K2为加1设置,K3为减1设置

 

 湿度低于88%;警报响,红灯亮

 

#include <stm32f4xx.h>
#include "delay.h"
#include "DHT11.h"
#include "LCD1602.h"
#include "SOUN.h"
#include "KEY_ExitInit.h"
#include "LED_INIT.h"
#include "HCSR04.h"
unsigned char move = 0x82;
unsigned char RH,RL,TH,TL;
unsigned char h0 = 0X38,h1 = 0X36;
unsigned char t0 = 0X32,t1 = 0X38;
unsigned char DATA[4];//存温湿度数据
unsigned char Leg[4];//存超声波
unsigned char R[7] = "SD:";
unsigned char H[7] = "WD:";
unsigned char L[7] = "Legth:";
unsigned char r[2] = "%";
unsigned char h[2] = "C";
// 读DHT11数据及数据转换 ///
int DHT11_ReadDATA(void)
{
	int i;

省略。。

 【资源下载】下载地址:点击下载(1648) 百度网盘

标签:char,温湿度,unsigned,STM32,HCSR04,include,测距,DHT11
来源: https://blog.csdn.net/jingdianjiuchan/article/details/121982014