Get Average Readings from DHT22

Can you further explain how “tenths of degrees” work?

Use code that perhaps provide the temperature as an “int” in the unit “tenths of degrees”.

Thank you.

There have been reports that some sensors have pin 3 and 4 reversed, probably as a quality control/manufacturing issue. If you have issues, consider grounding both pins 3 and 4.


try this snippet, you should get the idea

float sum = 0;
int readings = 6; 
while( readings > 0)
  float x = readTemperature();
  if (isnan(x)) continue;           // effectively go back to start of while
  sum += x;
float average = sum / 6;