Ubidots Community

[SOLVED] Can i do arithmatic operation and casting on value[]

Continuing the discussion from I want to get multiple data from the ubidots using android app:

I’ve already answered you the question of the casting at http://community.ubidots.com/t/i-want-to-get-multiple-data-from-the-ubidots-using-android-app/400/4?u=juanda95

And the arithmetic operation, would work normally:

double fahrenheitTemperature = myTemperatureSensorValues[0].getValue();
double celsiusTemperature = 5/9*(fahrenheitTemperature - 32);

Or if you want to operate two or more values:

double sumOfTemperatures = 0;
for (Value v : myTemperatureSensorValues) {
    sumOfTemperatures += v.getValue();
}

If you need to do some statistic with your values, there are also methods for doing that. They are documented here: https://github.com/ubidots/ubidots-java#getting-basic-statistic-data