DHT 11 Code Help Needed
NWCCTV
Posts: 3,629
I seem to be having another brain spasm here. Can someone tell me what Pin I am suppose to use in the attached program? I see the call to "APin" but I do not see which pin that is connected to. Thanks for the help.
Comments
In this case you need to pass the pin connected to the sensor, and pointers to longs that hold the temperature, humidity, and parity error code. While I don't condone direct pin # use (i.e., magic # in listing), I will in this example
...where the sensor is connected to P15, and you have the longs temp, humid, and error defined in your top object.
Proper objects do not force you to use specific IO pins (there are a few reasonable exceptions); YOU decide which pin to use and then tell the object what it is.
Easy-peasy.
So, what is wrong with this code? The way it is written, I can't make heads nor tails of it (no surprise, I'm not that good of a programmer). I tried different pins, same results.
Any help I can get would be greatly appreciated!