STM32版Gokit零基础开发之驱动单总线设备DHT11温湿度传感器2-Arduino中文社区 - Powered by Discuz! Archiver

机智宝 发表于 2016-11-10 15:15

STM32版Gokit零基础开发之驱动单总线设备DHT11温湿度传感器2

本文在http://club.gizwits.com/thread-3993-1-1.html基础上添加了FreeRTOS操作系统,创建了3个任务,分别是LED1每隔500ms翻转、串口每隔2s打印Hello World!、每隔1s读取DHT11温度传感器的数值并打印;
主要步骤如下:
step1:添加FreeRTOS组件,SYS时钟源换为TIM4,systick作为FreeRTOS的心跳;
http://club.gizwits.com/data/attachment/forum/201611/09/203012ojqlrxk07kkp7qpq.png


添加3个任务;
http://club.gizwits.com/data/attachment/forum/201611/09/203019k8iy5scc71s6i83b.png

填充用户代码;
http://club.gizwits.com/data/attachment/forum/201611/09/203038lj9vcj02z42m10jz.png

一切OK后,串口调试助手显示如下:
http://club.gizwits.com/data/attachment/forum/201611/09/203400o6ncn9k99w9j94qt.png 1s TASK::temperature=19,humidity=31

附完整工程下载:
http://club.gizwits.com/static/image/filetype/zip.gif GokitDemoDHT11-OS.zip
页: [1]
查看完整版本: STM32版Gokit零基础开发之驱动单总线设备DHT11温湿度传感器2