from machine import Pin
from time import sleep
keypad_matrix= [['1', '2', '3', 'A'],
                ['4', '5', '6', 'B'],
                ['7', '8', '9', 'C'],
                ['*', '0', '#', 'D']]
keypad_colun = [6,5,4,3]
keypad_lin = [10,9,8,7]
coluna = []
linha =[]

for x in range(0, 4):
    linha.append(Pin(keypad_lin[x], Pin.OUT))
    linha[x].value(1)
    coluna.append(Pin(keypad_colun[x], Pin.IN, Pin.PULL_DOWN))
    coluna[x].value(0)

def scankeys():
    for row in range(4):
        for col in range(4):
            linha[row].high()
            key = None

            if coluna[col].value() == 1:
                print("voce pressionou:", keypad_matrix[row][col])
                key_pressed = keypad_matrix[row][col]
                sleep(0.3)
        linha[row].low()
#=======================================#
while True:
    scankeys()
   
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT