quen0n/DHT11-DHT22-STM32-HAL

2 DHT11 sensors

Duhamoras opened this issue · 8 comments

It is available to use two same sensors?

Yes, just add another sensor to the menu

I'm trying to do that, but can't understad, why it's not working, Pins are conected properly, because with one sensor while testing both works. But when trying to get data from two sensors I get only from one. Maybe you can help a little bit and show, what to add to code to get data?

Oops, I messed up the repositories

Show your code that you use to get data from sensors

I'm just using Your code with DHT11 and trying to read second DHT11 sensor. Just trying a lot of variations, because I'm not good at programing. At first I need to know that do I need to change anything in DHT.c or DHT.h files or just make changes in my main.c file?

My main.c file moments:

/* USER CODE BEGIN 1 */

 DHT_sensor livingRoom = {GPIOA, GPIO_PIN_1, DHT11, GPIO_NOPULL};
 DHT_sensor bedRoom = {GPIOC, GPIO_PIN_0, DHT11, GPIO_NOPULL};

/* USER CODE END 1 */

while (1)
{

//Receiving data from the sensor
DHT_data d = DHT_getData (&livingRoom);
DHT_data e = DHT_getData (&bedRoom);
}

Today I have done a lot of changes, but now can't remember what I done, because it not worked

No, you don't need to make any changes to DHT.h and DHT.c. If you connect the sensors correctly and specify the connection port correctly, then everything should work

Tiredness is bad thing... All day working on project and did a stupid mistake in code. Everything works good now, thanks for Your time and a good work on these sensors:)

I'm glad you made it

It was easy job and I managed to fail it