Can't get proper value from DHT11

I'm using the code shown here ( with the DHT11 temperature / humidity sensor. This code works great and print the output to the serial port without a problem. I want to change the code and plug the values into variables. I have no idea where to start as the data is currently stored in a byte (i think). Any knowledge about this subject would be great.

What are you actually trying to achieve? To pull the results out into some variables is trivial based on how I think it works.

float humidity;
ReadDHT();//This is the "heart" of the program.
humidity = dht_dat[0] + dht_dat[1] / 100;

That should give you a floating point value corresponding to the current humidity returned. You could print that back out to ensure you're getting the same value...

Never having used that sensor, nor read its datasheet, the above might not be exact, but it'll be close.


WOW... I feel very stupid. This works great! I was trying to use int and double and this would fail. Float seemed to do the trick. Thanks!