Giter Club home page Giter Club logo

aht21_for_stm32's Introduction

aht21_for_stm32

基于奥松AHT21温湿度传感器开发的STM32(HAL)控制代码

使用方法

将aht21头文件及函数文件加入工程

硬件读取

修改宏定义AHT21_MODE为HARD
并在主函数引用头文件

读取温湿度

void GetAHT21Data(I2C_HandleTypeDef *hi2c,float *humidity, float *temperature);
//hi2c        I2C通道
//humidity    湿度
//temperature 温度

软复位

void ResetAHT21(I2C_HandleTypeDef *hi2c);
//hi2c        I2C通道

初始化

void StartAHT21(I2C_HandleTypeDef *hi2c);
//hi2c        I2C通道

软件读取

修改宏定义AHT21_MODE为SOFT
按照使用引脚修改SCL和SDA引脚

#define SCL_Pin GPIO_PIN_8
#define SCL_GPIO_Port GPIOE
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOE

并在主函数引用头文件

读取温湿度

void GetAHT21Data(float *humidity, float *temperature);
//humidity    湿度
//temperature 温度

软复位

void ResetAHT21(void);

初始化

void StartAHT21(void);

未来计划

  • HAL库硬件I2C支持
  • 传感器软复位/初始化

aht21_for_stm32's People

Contributors

chengzhi233 avatar

Stargazers

freelife avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.