mDot with DHT library
- This topic has 1 reply, 2 voices, and was last updated 8 years, 2 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
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.
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