micro:bit with 3×4 keypad

Connect the 4 Row Pins to micro:bit’s P1, P2, P8, P12
R1 -> P1, P2 -> P2, R3 -> P8, R4 -> P12

Connect the 3 Column Pins to P13, P14, P15
C1 -> P13, C2 -> P14, C3 -> P15

The way you find out which key is pressed is you set R1/P1 ON. Then check if C1/P13 (‘1’), C2/P14 (‘2’), or C3/P15 (‘3’) are ON.

If none of those are on, reset R1/P1, and set R2/P2 ON, and repeat the logic for C1, C2, C3 (keys ‘4’, ‘5’, ‘6’).

If none of those check out, move on to Row 3, and so on…

You can find the code to read from keypad here