Codey OnlineBiblioteca de componentes Arduino y ESP32 › DHT11 Sensor Module
DHT11 Sensor Module
Sensores

DHT11 Sensor Module

Módulo sensor de temperatura y humedad DHT11

Ancho: 35.4 mm

Pinout — DHT11 Sensor Module

Pin Señal Descripción
VCC power Top right edge header hole for VCC
DAT data Middle right edge header hole for data
GND ground Bottom right edge header hole for ground

Esquema de cableado de ejemplo — DHT11 Sensor Module

Desde Hasta Cable
board:5V x1:VCC red
board:GND x1:GND black
board:D2 x1:DAT green

Código Arduino de ejemplo — DHT11 Sensor Module

Este ejemplo se escribió y verificó por compilación para arduino-uno. Codey Online lo adapta a cualquier otra placa compatible.

#include <DHT.h>

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
  Serial.println("DHT11 sensor module example");
}

void loop() {
  delay(2000); // DHT11 needs a slow refresh rate

  float humidity = dht.readHumidity();
  float temperatureC = dht.readTemperature();

  if (isnan(humidity) || isnan(temperatureC)) {
    Serial.println("Failed to read from DHT11 sensor");
    return;
  }

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.print(" %\tTemperature: ");
  Serial.print(temperatureC);
  Serial.println(" *C");
}

Componentes relacionados

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Crea tu proyecto de Arduino o ESP32 con IA

Describe lo que quieres construir. Codey Online escribe el codigo, dibuja el esquema de conexiones, lo compila y graba tu placa directamente desde el navegador.

Empieza gratis