Skip to content

How to simulate DHT22 and use it with RP2040 to read temperature and humidity? #127

Closed
@TBWXY777

Description

@TBWXY777

Hi, I am trying to use the DHT22 temperature and humidity sensor with RP2040, and I want to simulate the sensor.
I am hoping to find some guidance on how to simulate the DHT22 sensor and use it with RP2040 to read temperature and humidity. I have attached my current Arduino code below:

#include "DHT.h"

#define GPIOPIN 2
#define DHTTYPE DHT22

DHT dht(GPIOPIN, DHTTYPE);

void setup() {
  Serial1.begin(9600);
  dht.begin();
}

void loop() {
  delay(200);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  Serial1.print("Humidity: ");
  Serial1.print(h);
  Serial1.print("%  Temperature: ");
  Serial1.print(t);
  Serial1.println("°C");
}

I have seen DHT22 on both wokwi-elements and the Wokwi platform, but I am not sure how it interacts with RP2040.
Thank you very much for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions