DHT11 Pico Library - C++ - Raspberry Pi Pico
1.0
The DHT11 Pico Library provides a C++ implementation for interfacing with the DHT11 temperature and humidity sensor on the Raspberry Pi Pico microcontroller. It offers functions to read temperature and relative humidity from the sensor and supports error handling. This library simplifies the integration of the DHT11 sensor into Pico-based projects, allowing developers to easily retrieve environmental data for various applications.
|
DHT11 Sensor Class. More...
#include <dht11-pico.h>
Public Member Functions | |
Dht11 (uint pin) | |
Dht11 class constructor. Initializes GPIO and waits for the sensor to stablize. More... | |
~Dht11 () | |
Dht11 class destructor. De-initialize GPIO. | |
double | readT (void) |
Read and retrieve the temperature value from the DHT11 sensor. More... | |
double | readRH (void) |
Read and retrieve the humidity value from the DHT11 sensor. More... | |
void | readRHT (double *temperature, double *rel_humidity) |
Read both temperature and humidity values from the DHT11 sensor. More... | |
Private Member Functions | |
long long | read (void) |
Private method to read raw data from the DHT11 sensor. More... | |
Private Attributes | |
uint | gpioPin |
GPIO pin connected to the DHT11 sensor. | |
DHT11 Sensor Class.
This class provides methods to initialize, read, and retrieve temperature and humidity values from the DHT11 sensor.
Definition at line 62 of file dht11-pico.h.
Dht11::Dht11 | ( | uint | pin | ) |
Dht11 class constructor. Initializes GPIO and waits for the sensor to stablize.
pin | GPIO pin number connected to the DHT11 sensor. |
Definition at line 13 of file dht11-pico.cpp.
|
private |
Private method to read raw data from the DHT11 sensor.
This method reads the raw data from the DHT11 sensor by sending and receiving pulses to determine the temperature and humidity values.
Definition at line 23 of file dht11-pico.cpp.
double Dht11::readRH | ( | void | ) |
Read and retrieve the humidity value from the DHT11 sensor.
This method reads the humidity value from the DHT11 sensor and returns it as a double value. If there is a transmission error, TRANSMISSION_ERROR is returned.
Definition at line 100 of file dht11-pico.cpp.
void Dht11::readRHT | ( | double * | temperature, |
double * | rel_humidity | ||
) |
Read both temperature and humidity values from the DHT11 sensor.
temperature | Pointer to a double variable to store the temperature value. |
humidity | Pointer to a double variable to store the humidity value. |
This method reads both the temperature and humidity values from the DHT11 sensor and stores them in the provided variables. If there is a transmission error, the values are set to TRANSMISSION_ERROR.
Definition at line 111 of file dht11-pico.cpp.
double Dht11::readT | ( | void | ) |
Read and retrieve the temperature value from the DHT11 sensor.
This method reads the temperature value from the DHT11 sensor and returns it as a double value. If there is a transmission error, TRANSMISSION_ERROR is returned.
Definition at line 87 of file dht11-pico.cpp.