nethoncho/Arduino-DHT22 — pull request #2 by ringerc (2012-01-15 10:18:47+00:00)
Title: Arduino 1.0 update, access to integer values, inlines

Hi

I've tweaked your DHT-22 library to fit my purposes, and thought the changes might be useful. Feel free to grab what you want.

I had to alter it to get it to build with the Arduino IDE 1.0 environment. Additionally, I wanted access to the integer values and wanted to avoid the need to use floating point, so I changed the class to store the original short ints from the sensor, corrected for the strange negative format used. The float accessors do the conversion on demand.

I've made the integer and float accessors available as inlines; the integer accessor in particular will inline to smaller than the function call would've, as well as being faster.

Your sensor library works much more reliably than the interrupt-driven hack I wrote before finding it, and doesn't consume any of those precious interrupt-capable pins either. Thanks very much for it.