dht22

Hi
i,m a newbie
I have an Arduino mega 2560.
Starter kit

I have copied somebody else’s sketch_dht22-1.
I can get the lights come on and off according to temperature or humidity but the problem is cannot do both at the same time.

Example. If humidity is 40 turn on dehumidifier and if temperature falls below 20 turn on heater

I would like to to monitor humidity and temperature and then take two different actions based on
temperature and humidity.

This is the line where I think I’m going wrong
if (h>=25) this is what tried if (h>=25 & t >=10) if this makes any sense to you.
I’m going to try send sketch like I said i,m a newbie

Thanks Paul

dht22.txt (1.48 KB)

  // Wait 5 seconds before starting the next reading.
  delay(1000);

If you are going to have useless comments, you MUST make the code match the comments.

Where do you do anything with the temperature reading?