MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4DHT11< PIN1, PIN2 > Class Template Reference

A template class to interface with the DHT11 temperature & humidity sensor. More...

#include <MiniR4_DHT11.h>

Public Member Functions

 MiniR4DHT11 ()
 
void setDelay (unsigned long delay)
 Sets the delay between consecutive sensor readings.
 
float readTemperature ()
 Reads and returns the temperature from the DHT11 sensor.
 
int readHumidity ()
 Reads and returns the humidity from the DHT11 sensor.
 
int readTemperatureHumidity (float &temperature, int &humidity)
 
String getErrorString (int errorCode)
 

Static Public Attributes

static const int ERROR_CHECKSUM = 254
 
static const int ERROR_TIMEOUT = 253
 
static const int TIMEOUT_DURATION = 1000
 

Detailed Description

template<uint8_t PIN1, uint8_t PIN2>
class MiniR4DHT11< PIN1, PIN2 >

A template class to interface with the DHT11 temperature & humidity sensor.

This class provides methods to read temperature and humidity data from a DHT11 sensor, as well as error handling mechanisms.

Template Parameters
PIN1Unused in current implementation, can be defined for future expansions.
PIN2The GPIO pin connected to the DHT11 sensor.

Definition at line 31 of file MiniR4_DHT11.h.

Constructor & Destructor Documentation

◆ MiniR4DHT11()

template<uint8_t PIN1, uint8_t PIN2>
MiniR4DHT11< PIN1, PIN2 >::MiniR4DHT11 ( )
inline

Definition at line 34 of file MiniR4_DHT11.h.

Member Function Documentation

◆ getErrorString()

template<uint8_t PIN1, uint8_t PIN2>
String MiniR4DHT11< PIN1, PIN2 >::getErrorString ( int errorCode)
inline

Converts error codes into human-readable strings.

Parameters
errorCodeError code to convert.
Returns
String describing the error.

Definition at line 127 of file MiniR4_DHT11.h.

◆ readHumidity()

template<uint8_t PIN1, uint8_t PIN2>
int MiniR4DHT11< PIN1, PIN2 >::readHumidity ( )
inline

Reads and returns the humidity from the DHT11 sensor.

Returns
Humidity percentage, or an error code if the reading fails. Error codes:
  • 254: Checksum mismatch
  • 253: Timeout

Definition at line 87 of file MiniR4_DHT11.h.

◆ readTemperature()

template<uint8_t PIN1, uint8_t PIN2>
float MiniR4DHT11< PIN1, PIN2 >::readTemperature ( )
inline

Reads and returns the temperature from the DHT11 sensor.

Returns
Temperature in Celsius, or an error code if the reading fails. Error codes:
  • 254: Checksum mismatch
  • 253: Timeout

Definition at line 66 of file MiniR4_DHT11.h.

◆ readTemperatureHumidity()

template<uint8_t PIN1, uint8_t PIN2>
int MiniR4DHT11< PIN1, PIN2 >::readTemperatureHumidity ( float & temperature,
int & humidity )
inline

Reads temperature and humidity.

Parameters
temperatureReference to store temperature.
humidityReference to store humidity.
Returns
0 on success, otherwise error code.

Definition at line 106 of file MiniR4_DHT11.h.

◆ setDelay()

template<uint8_t PIN1, uint8_t PIN2>
void MiniR4DHT11< PIN1, PIN2 >::setDelay ( unsigned long delay)
inline

Sets the delay between consecutive sensor readings.

By default, the delay is set to 250 milliseconds. This can be adjusted using this method.

Parameters
delayThe delay in milliseconds between sensor readings.

Definition at line 53 of file MiniR4_DHT11.h.

Member Data Documentation

◆ ERROR_CHECKSUM

template<uint8_t PIN1, uint8_t PIN2>
const int MiniR4DHT11< PIN1, PIN2 >::ERROR_CHECKSUM = 254
static

Definition at line 41 of file MiniR4_DHT11.h.

◆ ERROR_TIMEOUT

template<uint8_t PIN1, uint8_t PIN2>
const int MiniR4DHT11< PIN1, PIN2 >::ERROR_TIMEOUT = 253
static

Definition at line 42 of file MiniR4_DHT11.h.

◆ TIMEOUT_DURATION

template<uint8_t PIN1, uint8_t PIN2>
const int MiniR4DHT11< PIN1, PIN2 >::TIMEOUT_DURATION = 1000
static

Definition at line 44 of file MiniR4_DHT11.h.


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