Hi,
I'm currently stuck on planning the wiring for a key matrix with a arduino micro. Here is what I got so far
My question now is how do I connect the pins for all the switches. By connecting the black wires to 5v with a resistor between the default would be HIGH and on closing the switches the pins connected by the red wires would be HIGH and the corresponding black wire pin would be low? But as the red wire pins are not connected to anything they wouldn't read anything if all switches are opened?
The signals available on the six pin ISP connector are just duplicates of pins available elsewhere that are just arranged into a standard format for connection with an external programmer. Specifically, the three pins that you show connected to the switches via black lines are duplicates of pins shown with red lines. MISO is the same as digital pin 12, SCK is 13 and SS is pin 10. At a minimum, move your two analog inputs to A6 and A7 and use A0 through 5 as digital inputs.
If it were my design, I’d remap the 30 switches into a 5 x 6 matrix and use the available pins of port D and port C so you can read and write using direct port manipulation.
Yes missed that because the posted image was too small. However you just need to move those bottom three lines to other unused pins. Did you know you can use the analogue inputs A0 to A5 as digital inputs or outputs as well as analogue inputs?
Given that you sort out the matter of redundant pins, you simply set the "black" lines to INPUT_PULLUP and default the "red" lines to either HIGH or INPUT (or indeed, INPUT_PULLUP) then pull each in turn to LOW (as an OUTPUT) while you read the "black" lines.