bool Switch[6]; // An array of six switch status bools SetOutputLow(P1); // Setting P1 output low allows reading of P2 and P3. SetInputPullup(P2); SetInputPullup(P3); Switch[0] = Read(P2); Switch[1] = Read(P3); SetOutputLow(P2); // Setting P2 output low allows reading of P1 and P3. SetInputPullup(P1); SetInputPullup(P3); Switch[2] = Read(P1); Switch[3] = Read(P2); SetOutputLow(P3); // Setting P3 output low allows reading of P1 and P2. SetInputPullup(P1); SetInputPullup(P3); Switch[4] = Read(P1); Switch[5] = Read(P3);