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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login