A library for the use of DHT11, a temperature and humidity sensor
Dependents: HTTP_SERVER2 lightweight-weather-station
DHT11 Class Reference
Example: More...
#include <DHT11.h>
Public Member Functions | |
DHT11 (PinName pin) | |
Create a DHT11 interface. | |
int | readData (void) |
Reading the data from the DHT11. | |
int | readHumidity (void) |
Reading the humidity from the data. | |
int | readTemperature (void) |
Reading the temperature from the data. |
Detailed Description
Example:
#include "mbed.h" #include "DHT11.h" DHT11 d(PTD1); main() { int s; s = d.readData(); if (s != DHT11::OK) { printf("Error!\r\n"); } else { printf("T:%d, H:%d\r\n", d.readTemperature(), d.readHumidity()); } }
Definition at line 44 of file DHT11.h.
Constructor & Destructor Documentation
DHT11 | ( | PinName | pin ) |
Member Function Documentation
int readData | ( | void | ) |
int readHumidity | ( | void | ) |
Reading the humidity from the data.
- Returns:
- Humidity in %, regardless of the error from readData()
int readTemperature | ( | void | ) |
Reading the temperature from the data.
- Returns:
- Temperature in Celcius, regardless of the error from readData()
Generated on Mon Jul 18 2022 19:32:19 by 1.7.2