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:
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()
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?