Hi,
I am trying to test and use dht11 as sensing humidity. I am using dht11 library.
Displaying on the serial monitor like:
dht11 DHT11_40;
#define DHT11PIN40 40;
int humid1;
....
Serial.print("Humidity (%): ");
Serial.println((float)DHT11_40.humidity, 40);
humid1=((float)DHT11_40.humidity, 40);
I know problem is humid1 is int, but I need to use as int (sending value to server, sd card... ).
How can I convert or use it as int instead of float? I guess dht11 giving back float values...??
Thanks!
if I try to use just like:
Serial.print("Humidity (%): ");
Serial.println((float)DHT11_40.humidity, 40);
Serial.println((int)DHT11_40.humidity, 40);
serial monitor sais:
Read sensor 1 on pin40: OK
Humidity (%): 48.0000000000000000000000000000000000000000
18
Serial.print("Humidity (%): ");
Serial.println((float)DHT11_40.humidity, 40);
humid1=((float)DHT11_40.humidity, 40);
Serial.print("Humidity (%): ");
humid1=DHT11_40.humidity);
Serial.println(humid1);
Thanks knut_ny! Working fine!
I guess dht11 giving back float values...??
Don't "GUESS". Look at the code and see what type the function will return.