26 gpio_set_dir(
gpioPin, GPIO_OUT);
58 for(
int i=0;i<40;i++){
96 double temp = temp_int + 0.1*temp_dec;
101 long long raw=
read();
107 double rh = rh_int + 0.1*rh_dec;
112 long long raw=
read();
122 *temp = temp_int + 0.1*temp_dec;
123 *rh = rh_int + 0.1*rh_dec;
long long read(void)
Private method to read raw data from the DHT11 sensor.
double readRH(void)
Read and retrieve the humidity value from the DHT11 sensor.
uint gpioPin
GPIO pin connected to the DHT11 sensor.
Dht11(uint pin)
Dht11 class constructor. Initializes GPIO and waits for the sensor to stablize.
double readT(void)
Read and retrieve the temperature value from the DHT11 sensor.
~Dht11()
Dht11 class destructor. De-initialize GPIO.
void readRHT(double *temperature, double *rel_humidity)
Read both temperature and humidity values from the DHT11 sensor.
DHT11 Sensor Library for Raspberry Pi Pico.
const int THRESHOLD
Threshold for differentiating between bit 0 and bit 1 during DHT11 data transmission.
const int POLLING_LIMIT
Maximum number of polling attempts during DHT11 data transmission.
const long long RH_DEC_MASK
Bit mask to extract the decimal part of relative humidity from the raw data.
const long long CHECKSUM_MASK
Bit mask to extract the checksum from the raw data.
const long long TEMP_INT_MASK
Bit mask to extract the integer part of temperature from the raw data.
const int TRANSMISSION_ERROR
Error value returned when there is a transmission error during DHT11 data reading.
const long long TEMP_DEC_MASK
Bit mask to extract the decimal part of temperature from the raw data.
const long long RH_INT_MASK
Bit mask to extract the integer part of relative humidity from the raw data.