Trying to divide two variables to obtain value for another variable

I am using a DHT11 humidity sensor and the DHT sensor library for a project. I am able to print the humidity and temperature collected by the sensor unto the serial monitor. I want to be able to take these two values and use them in a division operation. When I try to do that, all that displays is a 0 for the value of the new variable. Electronics_Pro.ino (1.7 KB)

Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Please post the code properly, here, so we do not have to download the code. Many members do not download code.

int humidityconstant = tempF/humidity; //High Temperature Raises Amount Of Water Added While High Humidiy Lowers 

At that point in the sketch neither variable has a value. They are both 0.0. You have to read the DHT before those variables have value.

Thanks, that fixed the issue

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.