版本协议

BSD License

专业版
#第九届立创电赛#温湿度检测仪7823043A

创建时间:9个月前

97 0

描述

<div> <h3 style="line-height:1.8">* 1、项目功能介绍</h3> <hr> <p style="line-height:1.8">参加立创训练营制作桌面温湿度监测仪,可作为桌面摆件使用</p> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">*2、项目属性</h3> <hr> <p style="line-height:1.8">项目为首次公开,属于原创作品,无其他参赛经历</p> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">* 3、开源协议</h3> <hr> <p style="line-height:1.8">BSD</p> <h3 style="line-height:1.8">*4、硬件部分</h3> <hr> <p style="line-height:1.8">通过5号电池供电使其温湿度同时显示</p> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">*5、软件部分</h3> <hr> <p style="line-height:1.8">定时器中断函数:</p> <div>void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){</div> <div>if(htim == &htim3){</div> <div>num++;</div> <div>if(num < 100)</div> <div>{</div> <div> </div> <div>    /* USER CODE END WHILE */</div> <div> </div> <div>    /* USER CODE BEGIN 3 */</div> <div> </div> <div>ShowNum(1,1,Temp/100);</div> <div>ShowNum(1,2,Temp/ 10 % 10);</div> <div>ShowNum(1,3,Temp%10);</div> <div> </div> <div>}</div> <div>else if(num < 200)</div> <div>{</div> <div>ShowNum(2,1,Humi/100);</div> <div>ShowNum(2,2,Humi/ 10 % 10);</div> <div>ShowNum(2,3,Humi%10);</div> <div>}</div> <div>else{</div> <div>num = 0;</div> <div>ShowNum(1,1,Temp/100);</div> <div>ShowNum(1,2,Temp/ 10 % 10);</div> <div>ShowNum(1,3,Temp%10);</div> <div>}</div> <div> </div> <div>}</div> <div>}</div> <div> </div> <div> </div> <div>main主函数:</div> <div> <div>int main(void)</div> <div>{</div> <div>  /* USER CODE BEGIN 1 */</div> <div> </div> <div>  /* USER CODE END 1 */</div> <div> </div> <div>  /* MCU Configuration--------------------------------------------------------*/</div> <div> </div> <div>  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */</div> <div>  HAL_Init();</div> <div> </div> <div>  /* USER CODE BEGIN Init */</div> <div> </div> <div>  /* USER CODE END Init */</div> <div> </div> <div>  /* Configure the system clock */</div> <div>  SystemClock_Config();</div> <div> </div> <div>  /* USER CODE BEGIN SysInit */</div> <div>HAL_DeInit();</div> <div>  /* USER CODE END SysInit */</div> <div> </div> <div>  /* Initialize all configured peripherals */</div> <div>  MX_GPIO_Init();</div> <div>  MX_I2C1_Init();</div> <div>  MX_TIM3_Init();</div> <div>  HAL_TIM_Base_Start_IT(&htim3);</div> <div>  /* USER CODE BEGIN 2 */</div> <div>  HAL_TIM_PeriodElapsedCallback(&htim3);</div> <div> </div> <div>  /* USER CODE END 2 */</div> <div> </div> <div>  /* Infinite loop */</div> <div>  /* USER CODE BEGIN WHILE */</div> <div>  while (1)</div> <div>  {</div> <div>  SN74HC595_Send_Data(SN_DIG,0x00);</div> <div>  SN74HC595_Send_Data(SN_LED1,0x00);</div> <div>  SN74HC595_Send_Data(SN_LED2,0x00);</div> <div>  HAL_Delay(100);</div> <div>  HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)SHT40_Write, (uint8_t *)writeData, 1, HAL_MAX_DELAY);</div> <div>  HAL_Delay(10);</div> <div>  HAL_I2C_Master_Receive(&hi2c1, (uint16_t)SHT40_Read, (uint8_t *)readData, 6, HAL_MAX_DELAY);</div> <div> </div> <div>  Temperature = (1.0 * 175 * (readData[0] * 256 + readData[1])) / 65535.0 - 45;</div> <div>  Humidity = (1.0 * 125 * (readData[3] * 256 + readData[4])) / 65535.0 - 6.0;</div> <div> </div> <div>  Temp = (uint16_t)(Temperature * 10);</div> <div>  Humi = (uint16_t)(Humidity * 10);</div> <div>    /* USER CODE END WHILE */</div> <div> </div> <div>    /* USER CODE BEGIN 3 */</div> <div> </div> <div>  }</div> <div>  /* USER CODE END 3 */</div> <div>}</div> </div> <p style="line-height:1.8"> </p> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">*6、BOM清单</h3> <hr> <p style="line-height:1.8"> </p> <p style="line-height:1.8"><img src="//image.lceda.cn/oshwhub/676d1b7bd53748d7aa7af60a758d5272.png"></p> <p style="line-height:1.8"> </p> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">*7、大赛LOGO验证</h3> <hr> <p style="line-height:1.8"><img src="//image.lceda.cn/oshwhub/26b68551980a4451b4020e49f1200243.png"></p> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">* 8、演示您的项目并录制成视频上传</h3> <hr> <p style="line-height:1.8"> </p> <p style="line-height:1.8"><span style="color:#95a5a6;font-size:14px">视频标题:立创电赛:{项目名称}-{视频模块名称};如立创电赛:《自动驾驶》-团队介绍。</span></p> <p style="line-height:1.8"> </p> <p style="line-height:1.8"><span style="font-size:14px"><a href="/posts/de460543d4cf4dacb5f0326612455578" target="_blank">前往查看更多详情 ></a></span></p> <p style="line-height:1.8"> </p> </div>

文档

BOM

暂无

附件

附件名 下载
SHT40_Project_F.zip
立创电赛:温湿度检测仪-SHT40 .mp4

成员

评论(0)

  • 表情
    emoji
    小嘉工作篇
    小嘉日常篇
  • 图片
成功
工程所有者当前已关闭评论
goToTop
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow