private void writeStates() { string msg = ""; msg += " " + limit(outStates[0]); if (Properties.Settings.Default.channelsNumber == 4) { msg += " " + limit(outStates[1]); } msg += " " + limit(outStates[2]); msg += " " + limit(outStates[3]); myBt.write(packet + msg + "\n"); }