DHT why wait between readings, and why only take bytes 1-5 and 5-9?

grovepi
dht

#1

When looking at this go code: https://github.com/DexterInd/GrovePi/blob/9bfbcced7e2cf310e37e988bdda29356a00ef3b2/Software/Go/grovepi/grovepi.go#L106

There are some sleeps between readings. What is that for? Why do we need that wait?
Also, I understand that H and T data come in together in that array of bytes, and we need 32 bits for each piece, but why are we taking [1:5] and [5:9]? What is there in position 0?


#2

Hi @LuCavallin,

Long time no see.

There are some sleeps between readings. What is that for? Why do we need that wait?

Every time a transfer is effectuated, it takes some time for it to be sent to the receiving device. Because the mechanism on the GrovePi’s chip isn’t too advanced, it can’t pick up recurrent requests right after it has received a message, hence, we’d better give it enough time on the other side so that it can finish whatever it has to do.

Also, I understand that H and T data come in together in that array of bytes, and we need 32 bits for each piece, but why are we taking [1:5] and [5:9]? What is there in position 0?

This has to do with how the GrovePi sends the data to the Pi.

All in all, the GrovePi is about to enter a phase of fixing and/or refactoring the code - our team has spent the time on other projects for the past year or so.

Thank you!