mDot with DHT library

Home Forums mDot/xDot mDot with DHT library

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14905
    Eric Tsai
    Participant

    I’ve run into issues using the mDot with this common temperature/humidity sensor library:

    https://developer.mbed.org/users/Wimpie/code/DHT/

    I’m not able to get readings using a DHT22 sensor. Just to check my code and wiring, I used a ST Nucleo board dev that has a STM32 microcontroller on mBed, and it was pretty straight forward to get temperature and humidity readings from that setup using the same library. But the same setup on mDot results in 0 readings.

    My mDot code looks like this:

    #include "DHT.h"
     
    DHT mydht22(PC_1,DHT22); // DHT22 on PC_1 / Pin 15.  I've also tried PA_7 / pin 11.
     
    int main()
    {
            float test = 60.3;  //sanity check
            float mytemp = mydht22.ReadTemperature(FARENHEIT);  //value=32 all the time
            float myhum= mydht22.ReadHumidity(); //value=0 all the time
    }

    Are there some limitations on which pins are capable of using this DHT library? Just to remove doubt, I’m running the mDot on a breadboard, not the dev board, so there’s no chance of using the wrong pin on the dev board, or dev board hardware causing problems.

    #14919
    Andrew Lindsay
    Participant

    I’ve used this sensor or an equivalent (AM2302) with this library on port PA_0 without issues. This pin was chosen as it was available on the PCB I’ve developed for the mDot.

    Andrew

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.