DHT Code

Hi I am new to Arduino coding.

I am trying to figure out how the DHT.cpp sensor code works as provided by Adafruit: DHT-sensor-library/DHT.cpp at master · adafruit/DHT-sensor-library · GitHub

Is there an explanation of this code anywhere? I havent been able to find one in searching.

I am most confused by statements such as "f = data[2]". What does "data[2]" mean?

Thanks in advance for any advice.

Look in DTH.h and you will see a line uint8_t data[6];
This is (in effect) creating 6 variable called data[0], data[1], ... data[5] They always start at [0] so 6 variables will be numbered 0 to 5, 10 would be numbered 0 to 9

The line you refer to (f = data[2]) is getting variable 3 (don't forget numbering starts at zero) and putting it into a variable called f