High - middel - low / value


I try to use just the middel value at one of the buffer nodes. The values swapt in the buffer like( 5/2/6 or 2/5/6 or 6/2/5) I just want to grap the middel value (5) every time.
I simply do not find the easiest solution, maybe one of you guys?!

One option would be to use the min-buffer or min-buf-code from another discussion (How to write code to place timer values in order from low to high) to sort the values for you, then just pull the middle value.

Using min-buff-code, you probably want to RST all the buffers, then push 3 values on (flip-n-times is probably the easiest way to do that), then read the value from the middle buffer.

Since this code assumes you only run once on boot, RST of buffers is not really needed (but would be needed if sequence gets repeated later).
When flip-n-times-ACT changes to FALSE, you are ready to read your middle value.

Thanks a lot !
I realy apracieted your suggestion!
I just make an small change at the min-buff-code. That depends to my values I get from my sensor they incresse and decress in a small time range. I also take now two of the values if thay eqal.

If the two values are equal, it doesn’t matter which value goes where, but if you care anyway, use less-or-equal node instead of going crazy with if-else and multiple compares.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.