private void scanKeys() { for (byte c=0; c<cols.length; c++) { // Begin column pulse output. cols[c].on(); for (byte r=0; r<rows.length; r++) { // keypress is active low so invert to high. values[r][c] = rows[r].isActive(); } // Set pin to high impedance input. Effectively ends column pulse. cols[c].off(); } } }