Update dht22.c

Refactored the code a bit to fixed a few issues (input pin handling did not work) and made it a bit easier to use.