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.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Dht11 Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Dht11()

Dht11::Dht11 ( uint  pin)

Dht11 class constructor. Initializes GPIO and waits for the sensor to stablize.

Parameters
pinGPIO pin number connected to the DHT11 sensor.

Definition at line 13 of file dht11-pico.cpp.

Member Function Documentation

◆ read()

long long Dht11::read ( void  )
private

Private method to read raw data from the DHT11 sensor.

Returns
Raw data read 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.

◆ readRH()

double Dht11::readRH ( void  )

Read and retrieve the humidity value from the DHT11 sensor.

Returns
Humidity value read from the DHT11 sensor, or TRANSMISSION_ERROR if there is a transmission error.

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.

◆ readRHT()

void Dht11::readRHT ( double *  temperature,
double *  rel_humidity 
)

Read both temperature and humidity values from the DHT11 sensor.

Parameters
temperaturePointer to a double variable to store the temperature value.
humidityPointer 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.

◆ readT()

double Dht11::readT ( void  )

Read and retrieve the temperature value from the DHT11 sensor.

Returns
Temperature value read from the DHT11 sensor, or TRANSMISSION_ERROR if there is a transmission error.

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.


The documentation for this class was generated from the following files: