So I am reading in a value from a scale head that is set to continuously output. Right now I have a button that says when to grab a value from the scale. The only problem is that it gives me a long list of what appears to be every value since the last time I pressed the button. For example, I would get something like:
17.9 lbG
18.6 lbG
19.2 lbG
19.2 lbG
19.2 lbG
And this could go on for 20 or so more values.
The scripting I have on my button is as follows:
reading = event.source.parent.getComponent(āScaleReadInā)
weight = reading.readString()
print weight
Iām wondering whatās the best way to go about grabbing the very last value? I would use a .split() script but it seems that wouldnāt work if I donāt know how many values there will be. I was thinking about adding all the values to a list and then using something like list[-1]. Does this sound plausible or is there an easier way of going about it?