Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Seeed-Studio/Seeed_Arduino_AHT20
This library provides an example code to get the temperature and humidity from the AHT20 sensor.
https://github.com/Seeed-Studio/Seeed_Arduino_AHT20
arduino arduino-library humidity temperature
Last synced: about 1 month ago
JSON representation
This library provides an example code to get the temperature and humidity from the AHT20 sensor.
- Host: GitHub
- URL: https://github.com/Seeed-Studio/Seeed_Arduino_AHT20
- Owner: Seeed-Studio
- License: mit
- Created: 2020-06-09T02:22:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-28T03:41:46.000Z (over 1 year ago)
- Last Synced: 2024-04-26T03:40:03.590Z (5 months ago)
- Topics: arduino, arduino-library, humidity, temperature
- Language: C++
- Homepage:
- Size: 13.7 KB
- Stars: 9
- Watchers: 13
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Seeed_Arduino_AHT20 [![Build Status](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_ATH20.svg?branch=master)](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_ATH20)
## Introduction
AHT20 is a new generation of temperature and humidity sensor embedded with a dual-row flat and no-lead SMD package, suitable for the reflow soldering. AHT20 is equipped with a newly designed ASIC chip: an improved MEMS semiconductor capacitive humidity sensor, and a standard on-chip temperature sensor.
## Usage
```c++
// ARDUINO DEMO FOR GROVE-AHT20
//
#include
#include "AHT20.h"AHT20 AHT;
void setup()
{
Serial.begin(115200);
Serial.println("AHT20 DEMO");
AHT.begin();
}void loop()
{
float humi, temp;
int ret = AHT.getSensor(&humi, &temp);
if(ret) // GET DATA OK
{
Serial.print("humidity: ");
Serial.print(humi*100);
Serial.print("%\t temerature: ");
Serial.println(temp);
}
else // GET DATA FAIL
{
Serial.println("GET DATA FROM AHT20 FAIL");
}
delay(100);
}// END FILE
```## API
### void begin()
Initializing the AHT20
```c++
AHT.begin();
```### bool getSensor(float *h, float *t)
get all data of sensor
```c++
int ret = AHT.getSensor(&humi, &temp);
```### bool getTemperature(float *t)
get Temperature of sensor
```c++
int ret = AHT.getTemperature(&temp);
```### bool getHumidity(float *h)
get Humidity of sensor
```c++
int ret = AHT.getHumidity(&humi);
```