It's Holiday Sale Weekend at Adafruit - use the code ADATY to get 15% off items storewide! Some restrictions apply.
0

Matrix key scanning and the raspberry pi pico
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Matrix key scanning and the raspberry pi pico

by lesvaden3 on Thu Oct 21, 2021 7:59 pm

Hi,
I’m trying to matrix scan from the raspberry pi pico and it’s not working. Can you tell me if this code looks right?

import keypad
import board

km = keypad.KeyMatrix(
row_pins=(board.GP5, board.GP6),
column_pins=(board.GP0, board.GP1, board.GP2, board.GP3, board.GP4),
)

while True:
event = km.events.get()
if event:
print(event)

lesvaden3
 
Posts: 26
Joined: Sat Feb 01, 2020 3:38 pm

Re: Matrix key scanning and the raspberry pi pico

by lesvaden3 on Fri Oct 22, 2021 8:55 am

It works intermittently and then I get:
Warning:root:Unexpected echo. Expected b’%Run -c $Editor_content\r\n’ got b”

lesvaden3
 
Posts: 26
Joined: Sat Feb 01, 2020 3:38 pm

Re: Matrix key scanning and the raspberry pi pico

by tannewt on Mon Oct 25, 2021 3:46 pm

Are you using Thonny to program the device? It uses a unique way to load code and it looks like it's hit a problem. With CircuitPython, we recommend editing the code.py file on the drive directly. I'm not sure Thonny allows that.

I don't see any issues with your example code.

tannewt
 
Posts: 2664
Joined: Thu Oct 06, 2016 8:48 pm

Re: Matrix key scanning and the raspberry pi pico

by lesvaden3 on Mon Oct 25, 2021 3:51 pm

It worked when I resoldered a Mx switch and loaded it from MU. You’re right. Thonny probably isn’t the best. Thank you for helping me.

lesvaden3
 
Posts: 26
Joined: Sat Feb 01, 2020 3:38 pm

Re: Matrix key scanning and the raspberry pi pico

by tannewt on Mon Oct 25, 2021 4:08 pm

Glad you got it working!

tannewt
 
Posts: 2664
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.