Meter library m.updateMeter() only int type

hi,
I wanted to use the meter library but seems like the meter m.updateMeter() can only work with integer int type but I have float value and needed to display float values. How can I make it work?

thank you

1 Like

it would be so much helpful if you can post a code as a reference (for example, the code that works with integers, and you can point to the sections that you want to change to float)

1 Like

hi,
i forgot to tell that the solution was to adjust the range of the slider to match the float value. so i got this one. but thanks next time i will post the code.

1 Like

Sure. Note that the forum is not only a place for you to get answers but also for other users to find information, so if you find solutions it would be helpful if you can follow up :slight_smile:

2 Likes

Brand new to Processing here: I’m running into the same issue with m.updateMeter only accepting int, but not sure what the “slider” reference above refers to? In my case, I have a valid temp and humidity with 2 decimal places and just want the meter to display the full data:

if (port.available() > 0) {
String val = port.readString();
list = split(val, ‘,’);
float temp = float(list[0]);
float hum = float(list[1]);

println("Temperature: " + temp + " F  " + "Humidity: " + hum + " %");
m.updateMeter(int(temp));
m2.updateMeter(int(hum));

Maybe by design the library can only handle integers? In which case the OP’s question must be different.

Thanks for any ideas.

For my question, the answer was apparent after I figured out how to read the library reference:

m.setInformationAreaText(str(temp));