Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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(D8); // Here fill your PIN mask/name 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 Thu Jul 14 2022 08:31:08 by
