Ok, I took a look at the Sparkfun mux library. What I suggest is to use myMux.enablePort(x);
instead of myMux.setPort(x);
. Then, after communicating with the sensor on that port, before the end of the for-loop, put myMux.disablePort(x);
. This will ensure no ports are left open. Same for the other mux.