標(biāo)題: 電腦通過(guò)ESP8266控制DS18B20的電源,及上傳DS18B20的溫度 [打印本頁(yè)]

作者: yin_xin_lan    時(shí)間: 2017-4-29 16:22
標(biāo)題: 電腦通過(guò)ESP8266控制DS18B20的電源,及上傳DS18B20的溫度
此貼是根據(jù)野火的程序修改的,只能控制一個(gè)DS18B20。




單片機(jī)源程序:
  1. /**
  2.   ******************************************************************************
  3.   * @file    main.c
  4.   * @author  fire
  5.   * @version V1.0
  6.   * @brief   WF-ESP8266 WiFi模塊測(cè)試
  7.   ******************************************************************************
  8.   * @attention
  9.   *
  10.   * 實(shí)驗(yàn)平臺(tái):野火 iSO STM32 開發(fā)板
  11.   ******************************************************************************
  12.   */

  13. #include "stm32f10x.h"
  14. #include "bsp_usart1.h"
  15. #include "bsp_SysTick.h"
  16. #include "bsp_esp8266.h"
  17. #include "test.h"
  18. #include "bsp_dht11.h"

  19. /**************************************************************************************
  20. * 描  述 : GPIO_DSB初始化
  21. * 入  參 : 無(wú)
  22. * 返回值 : 無(wú)
  23. **************************************************************************************/
  24. void LED_Configuration(void)
  25. {
  26.         GPIO_InitTypeDef GPIO_InitStructure;
  27.         
  28.         /* Enable the GPIO_LED Clock */
  29.         RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB , ENABLE);                                                  
  30.                
  31.   GPIO_DeInit(GPIOB);         //將外設(shè)GPIOB寄存器重設(shè)為缺省值
  32.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  33.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  34.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  35.         GPIO_Init(GPIOB, &GPIO_InitStructure);
  36.         
  37.         GPIO_ResetBits(GPIOB , GPIO_Pin_9);   //初始狀態(tài),熄滅指示亮
  38. }
  39. /**
  40.   * @brief  主函數(shù)
  41.   * @param  無(wú)
  42.   * @retval 無(wú)
  43.   */
  44. int main ( void )
  45. {
  46.         /* 初始化 */
  47.         LED_Configuration ();
  48.         USARTx_Config ();                                                              //初始化串口1
  49.         SysTick_Init ();                                                               //配置 SysTick 為 1ms 中斷一次
  50.         ESP8266_Init ();                                                               //初始化WiFi模塊使用的接口和外設(shè)
  51.         //DHT11_Init ();                //初始化ds10b20


  52. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼

下載:
向電腦網(wǎng)絡(luò)助手上傳 ds18b20 溫度禁止修改 已驗(yàn)證.rar (757.5 KB, 下載次數(shù): 52)


作者: yin_xin_lan    時(shí)間: 2017-4-29 16:39
還需要下載一個(gè)獵豹WiFi熱點(diǎn)。開啟熱點(diǎn)后ESP8266回自動(dòng)連接到熱點(diǎn)上,連接上后就可以通信了




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