標(biāo)題: DHT11 STM32測(cè)試資料下載 [打印本頁]

作者: May-    時(shí)間: 2019-5-19 15:12
標(biāo)題: DHT11 STM32測(cè)試資料下載
DHT11測(cè)試資料

單片機(jī)源程序如下:
  1. /***************STM32F103C8T6**********************
  2. * 文件名  :main.c
  3. * 描述    :dht11傳感器
  4. * 備注    : dht11溫度濕度傳感器
  5. * 接口    :參看dht11.c

  6. ********************LIGEN*************************/

  7. #include "stm32f10x.h"
  8. #include "led.h"
  9. #include "usart1.h"
  10. #include "delay.h"
  11. #include "dht11.h"

  12. u8 temp;
  13. u8 humi;

  14. int main(void)
  15. {
  16.        
  17.   SystemInit();//配置系統(tǒng)時(shí)鐘為72M       
  18.         LED_GPIO_Config();//led初始化
  19.         USART1_Config();//串口初始化
  20.         Delay_init(72);
  21.         printf("Start \n");
  22.         while(DHT11_Init())
  23.         {
  24.                 printf("DHT11 Error \r\n");
  25.                 Delay_ms(1000);
  26.         }
  27.        
  28.   while (1)
  29.   {
  30.                 DHT11_Read_Data(&temp,&humi);//
  31.                 printf("temp %d ,humi %d\r\n",temp,humi);
  32.                 LED_Toggle();
  33.                 Delay_ms(1000);
  34.   }
  35. }
復(fù)制代碼

所有資料51hei提供下載:
DHT11測(cè)試資料.7z (268.86 KB, 下載次數(shù): 29)







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1