The wide deployment of wireless networks and mobile technologies, along with the
significant increase in the number of mobile device users, have CREATED a very strong
demand on various wireless-based, mobile-based software application systems and
enabling technologies. This not only provides many new business opportunities and
challenges to wireless and networking service providers, mobile technology ven-
dors, and software industry and solution integrators, butalso changes and enhances
people’s lives in many areas, including communications, information sharing and
exchange, commerce, home environment, education, and entertainment. Business
organizations and government agencies face new pressure fortechnology updatesto
upgrade their networking infrastructures with wireless connectivity to enhance
enterprise-oriented systems and solutions.
標(biāo)簽:
Wireless-Based
Software
Systems
上傳時(shí)間:
2020-06-01
上傳用戶:shancjb
STM32F103開(kāi)發(fā)板 DHT11溫濕度DS18B20 氣體MQ-2光敏聲控雨滴傳感器實(shí)驗(yàn)程序**--------------------------------------------------------------------------------------------------------** CREATED by: FiYu** CREATED date: 2015-12-12** Version: 1.0** Descriptions: DHT11溫濕度傳感器實(shí)驗(yàn) **--------------------------------------------------------------------------------------------------------** Modified by: FiYu** Modified date: ** Version: ** Descriptions: ** Rechecked by: **********************************************************************************************************/#include "stm32f10x.h"#include "delay.h"#include "dht11.h"#include "usart.h"DHT11_Data_TypeDef DHT11_Data;/************************************************************************************** * 描 述 : GPIO/USART1初始化配置 * 入 參 : 無(wú) * 返回值 : 無(wú) **************************************************************************************/void GPIO_Configuration(void){ GPIO_InitTypeDef GPIO_InitStructure; /* Enable the GPIO_LED Clock */ RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); GPIO_DeInit(GPIOB); //將外設(shè)GPIOA寄存器重設(shè)為缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽輸出 GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_DeInit(GPIOA); //將外設(shè)GPIOA寄存器重設(shè)為缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //推挽輸出 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //浮空輸入 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_SetBits(GPIOB , GPIO_Pin_9); //初始狀態(tài),熄滅指示燈LED1}/************************************************************************************** * 描 述 : 串口顯示實(shí)時(shí)溫濕度 * 入 參 : 無(wú) * 返回值 : 無(wú) **************************************************************************************/void DHT11_SCAN(void){ if( Read_DHT11(&DHT11_Data)==SUCCESS) { printf("\r\n讀取DHT11成功!\r\n\r\n濕度為%d.%d %RH ,溫度為 %d.%d℃ \r\n",\ DHT11_Data.humi_int,DHT11_Data.humi_deci,DHT11_Data.temp_int,DHT11_Data.temp_deci); //printf("\r\n 濕度:%d,溫度:%d \r\n" ,DHT11_Data.humi_int,DHT11_Data.temp_int); } else { printf("Read DHT11 ERROR!\r\n"); }}/************************************************************************************** * 描 述 : MAIN函數(shù) * 入 參 : 無(wú) * 返回值 : 無(wú) **************************************************************************************/int main(void){ SystemInit(); //設(shè)置系統(tǒng)時(shí)鐘72MHZ GPIO_Configuration(); USART1_Init(); //初始化配置TIM DHT11_GPIO_Config(); // 初始化溫濕度傳感器PB1引腳初始時(shí)為推挽輸出 GPIO_ResetBits(GPIOB , GPIO_Pin_9); delay_ms(500); while(1) { GPIO_SetBits(GPIOB , GPIO_Pin_9); DHT11_SCAN(); //實(shí)時(shí)顯示溫濕度 delay_ms(1500); } }
標(biāo)簽:
stm32f103
傳感器
上傳時(shí)間:
2022-05-03
上傳用戶:得之我幸78