Having trouble with an if statement

Please comment out all those Serial.write() statements, and add some Serial.print() and Serial.println() statements. We have no idea what values you are getting from amux.AnalogRead() on each of the 8 channels (if that is what the argument represents), and, apparently you don't either. So, print them.

Unplug whatever is connected to the Arduino's serial port. Connect the Arduino to the PC, and open the Serial Monitor. See what the incoming data is.

Then, you can determine if the if statements make sense, and what, exactly is going on.