Trouble combining sketches for temp and motion control
-
Its a problem with the DHT, the setup between Arduino and DHT sensor i think...
-Tried another DHT-Sensor or bare DHT code?
-Tried another inputpin on the arduino (i got this message when i didnt solder the pin properly)
-Check/change wiring.Also try the delay(dht.getMinimumSamplingPeriod()); before the motion sensor code and see if this changes anything.
-
Its a problem with the DHT, the setup between Arduino and DHT sensor i think...
-Tried another DHT-Sensor or bare DHT code?
-Tried another inputpin on the arduino (i got this message when i didnt solder the pin properly)
-Check/change wiring.Also try the delay(dht.getMinimumSamplingPeriod()); before the motion sensor code and see if this changes anything.
@sundberg84 I have two DHT22 sensors which I have tried both. They both work when I run the humidity sketch on its own but not when I try this sketch. Having never written code before this "delay(dht.getMinimumSamplingPeriod());" I have no clue what this is. Also if I used pin 5 for example how would I go changing the code to represent this. Cheers everyone so far for your help fault finding what's wrong with my set up. I don't usually give up but this simple one is testing my patients to the point I might just run a temp sensor on its own.
-
@sundberg84 I have two DHT22 sensors which I have tried both. They both work when I run the humidity sketch on its own but not when I try this sketch. Having never written code before this "delay(dht.getMinimumSamplingPeriod());" I have no clue what this is. Also if I used pin 5 for example how would I go changing the code to represent this. Cheers everyone so far for your help fault finding what's wrong with my set up. I don't usually give up but this simple one is testing my patients to the point I might just run a temp sensor on its own.
"delay(dht.getMinimumSamplingPeriod());" is used to not retrieve info from the DHT22 too often. The sensors don't respond if polled too frequently and this is a function in the DHT library. To change the sketch to use pin 5, change this line:
#define HUMIDITY_SENSOR_DIGITAL_PIN 6
to
#define HUMIDITY_SENSOR_DIGITAL_PIN 5
Is the sketch you are using identical to the one @hek posted? How are you powering your board?
Cheers
Al -
"delay(dht.getMinimumSamplingPeriod());" is used to not retrieve info from the DHT22 too often. The sensors don't respond if polled too frequently and this is a function in the DHT library. To change the sketch to use pin 5, change this line:
#define HUMIDITY_SENSOR_DIGITAL_PIN 6
to
#define HUMIDITY_SENSOR_DIGITAL_PIN 5
Is the sketch you are using identical to the one @hek posted? How are you powering your board?
Cheers
Al