selecting maximum value from a variable

hi all
I read several values from a load cell and I want to select the maximum value between them. can anyone help me?

How did you save them ? An array would be the obvious answer and it makes finding the max value easy. Even easier, save the maximum value as you read the series of values. No need to do it later.

UKHeliBob:
How did you save them ? An array would be the obvious answer and it makes finding the max value easy. Even easier, save the maximum value as you read the series of values. No need to do it later.

thank you for your answer
How to save the maximum of values?( without using array)

Max value

maxValue= max(maxValue,newReadValue);

Gabriel_swe: Max value

maxValue= max(maxValue,newReadValue);

Nice fish! Now, how to fish:

Somewhere, initialize (or reset) a variable like

maxSeen = -9999; /* whatever - way below anything you're gonna see */

then later do

if (newReadValue > maxSeen) maxSeen = newReadValue;

assuming of course that newReadValue comes from getting the current load cell value.

max(...)

is cool, but you still have to initialize (or reset) maxValue somehow.

Exercise for the reader: do something similar for minimum value seen.

alto777