If I am writing a motor’s temperature to a text file like this and I am getting values like 10.0 and 20.0, what are these values being returned as? Celsius? Fahrenheit? Percent?
ofs << "Motor Temperature: ";
ofs << Motor1.temperature();
Thanks!
If I am writing a motor’s temperature to a text file like this and I am getting values like 10.0 and 20.0, what are these values being returned as? Celsius? Fahrenheit? Percent?
ofs << "Motor Temperature: ";
ofs << Motor1.temperature();
Thanks!
Well, 10 and 20 degrees in Fahrenheit, Kelvin, and Celsius, all seem way too small to be what the motor is returning (the highest is about 68 degrees Fahrenheit, which isn’t even room temperature really). So I would guess that it is returning a percent value. Then, when I looked at the vexcode api I found that there are two commands for temperature. One takes a percent parameter, and one takes a temperature type parameter. So, I would assume that the default temperature command returns in percent. To change that, I would put a parameter in the temperature command that specifies what you would like the command to return. You could probably get it to return in Celsius, Fahrenheit, or other units by doing this.
How would I do this?
You could say:
Motor.temperature(temperatureUnits::celsius)
You could also use fahrenheit as well.
If the data I am getting is a percent, what is this out of? Then I could just calculate what the actual temperature is in degrees.
Here’s the info on “motor temperature in percent”, you can use this to convert to C or F:
But it would be easier (and less error-prone) to just pass temperatureUnits::celsius
or temperatureUnits::fahrenheit
to motor::temperature
and not have to worry about doing the conversion yourself.