
void setup() {
for (int i = 0; i < numRows; i++) {
pinMode(rows[i], INPUT_PULLUP);
}
for (int i = 0; i < numCols; i++) {
pinMode(col s[i], IN PU T);
}
Serial.begin(960 0);
}
This is where the code gets a bit tricky. We’re
going to fill every element in the second array by
cycling through rows and then columns. We can
see what column we’re in because we’ve set it to
OUTPUT, and then cycle through all the rows inside
of it. This way we don’t need as many pins, because
we are isolating each row.
Upload this code (Figure
J
) to your Arduino and
test it out! Have a look in the serial monitor to see
the output.
3. TEST YOUR PRESSURE TOUCH
MATRIX