Could you or someone tell me exactly where you got the <DHT.h> library from and if known is it compatible with mega 2560 v3? Been trying to do something similar for sometime having issues with matching libraries to sketch code samples. I'm very new to all this. Thanks
I found this thread which suits my needs and my difficulties at the moment quite well. I would like to know if anyone could quickly explain to me the following bit of code:
for (auto& sensor : dht) {
I tried to find answers on the web as to the meaning of "auto&" and ":" but couldnt find anything.
I tried to find answers on the web as to the meaning of "auto&" and ":" but couldnt find anything
That's a really good reason for not jamming the & up against the type. It makes no more sense than char*.
Auto means "I haven't a clue what type this variable should be. Compiler, you figure it out and use the proper type".
The rest of it means "I know that dht is an array, and I want you to figure out the length and iterate the proper number of times, handling each element of the array, one at a time."
I know that some people will disagree with my description of what auto means, but I don't really care.
Just for my further understanding some questions for clarification:
auto - gets a datatype for a variable with an unknown type?
& - is it "the addresse of"? And of what is it the addresse? The array?
: - I still don't understand the meaning of this sign. How could it be explained so I could use it independently the next time?
Is it true that I could use all of the above examples to reach the same goal?
I don know what is wrong with this example but its not working, The only message i got on serial is:
"dht11 start condition 2 not met". - problem is when I'm using as suggested the arrays, When Im using this