Using qsort to average readings

That sketch looks great, @BulldogLowell but when I try it out on a Photon, it locks up with or without sensors...
When I try with my original sketch, all works fine...

This is what I get on the serial monitor, when starting with 4 sensors and then one by one removing them:

22.6=D0 22.5=D1 22.5=D2 22.1=D3 T-av = 22.4
22.9=D0 22.5=D1 22.4=D2 22.3=D3 T-av = 22.5
22.9=D0 22.5=D1 22.8=D2 22.0=D3 T-av = 22.5
22.9=D0 22.5=D1 23.0=D2 22.3=D3 T-av = 22.7
22.9=D0 22.5=D1 22.5=D2 22.7=D3 T-av = 22.6
22.8=D0 22.3=D1 22.5=D2 T-av = 22.6
23.0=D0 22.8=D1 22.7=D2 T-av = 22.8
23.1=D0 22.5=D1 22.7=D2 T-av = 22.8
22.9=D0 22.3=D1 22.1=D2 T-av = 22.4
22.9=D0 22.5=D1 T-av = 22.7
23.1=D0 22.4=D1 T-av = 22.7
22.9=D0 22.6=D1 T-av = 22.8
23.0=D0 22.7=D1 T-av = 22.9
22.8=D0 T-av = 22.8
23.0=D0 T-av = 23.0
23.6=D0 T-av = 23.6
23.0=D0 T-av = 23.0

So, if you have no time, please don't bother!
I think it's an interesting exercise, but for me this is not essential.
I'm more interested how I can use "qsort" (or another command) to create a "median" filter for my sampled data.

In case you could find some time, you could flash your sketch to a Photon and see what happens without sensors:
The RGB led should stay Red continuously.
With another Photon and Tinker, you could connect a PWM pin to one of the inputs, simulating a sensor.
Then you should see the RGB led flash red and cyan each time a line of results is written to the serial monitor.

I cannot debug that sketch as I have to focus on work at hand for the time being.

Anyway, thanks for your help! :wave: :older_man: