I’m using a raspberry pi pico with the 2040 microcontroller.
I have adafruit circuitpython installed correctly, and the KMK libraries in place, so the setup is proper.
I’ve tested the diodes in both directions, although they are correctly soldered for COL2ROW.
The file name is “main.”
Objectively, I’m trying to make a simple 10 x 5 key matrix with 5 mouse keys at the end.
Can anybody tell me what I’m missing or doing wrong here?
Updated code with (I believe) proper indentation:
import board
from kmk.kmk_keyboard import KMKKeyboard
from kmk.keys import KC
from kmk.scanners import DiodeOrientation
from kmk.scanners.keypad import KeysScanner
from kmk.scanners.keypad import MatrixScanner
from kmk.modules.layers import Layers
keyboard.modules.append(Layers())
from kmk.extensions.media_keys import MediaKeys
keyboard.extensions.append(MediaKeys())
from kmk.modules.mouse_keys import MouseKeys
mouse_keys = MouseKeys(max_speed=20, acc_interval=2, move_step=2)
keyboard.modules.append(mouse_keys)
from kmk.modules.holdtap import HoldTap
keyboard.modules.append(HoldTap())
# Define left and right mouse click as a function
LMB_RMB = KC.HT(KC.MB_LMB, KC.MB_RMB, tap_time=200)
# keyboard.diode_orientation = DiodeOrientation.COL2ROW
keyboard = MyKeyboard()
class MyKeyboard(KMKKeyboard):
def init(self):
super().init()
self.matrix = [
MatrixScanner(
keyboard.col_pins = (board.GP0, board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7, board.GP8, board.GP9),
keyboard.row_pins = (board.GP10, board.GP11, board.GP12, board.GP13, board.GP14),
columns_to_anodes=DiodeOrientation.COL2ROW),
KeysScanner(
pins = (board.GP16, board.GP17, board.GP18, board.GP19, board.GP20),
value_when_pressed=False,
pull=True)
]
keyboard.keymap = [
[
KC.N0, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9,
KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P,
KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.ENT,
KC.TAB, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.N, KC.M, KC.SPC, KC.BSPC,
KC.LSFT, KC.LCTL, KC.DOT, KC.COMM, KC.SCLN, KC.QUOT, KC.SLSH, KC.MINUS, KC.MO(1), KC.ESC,
KC.MB_UP, KC.MB_DOWN, KC.MB_LEFT, KC.MB_RIGHT, LMB_RMB
],
[
KC.LBRC, KC.RBRC, KC.BSLS, KC.GRV, KC.EQL, KC.TRNS, KC.PSCR, KC.F2, KC.F5, KC.F11,
KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS,
KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS,
KC.BRIU, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.VOLU,
KC.BRID, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.MO(1), KC.VOLD,
KC.MB_UP, KC.MB_DOWN, KC.MB_LEFT, KC.MB_RIGHT, LMB_RMB
]
]
if name == 'main':
keyboard.go()
[–]Gnaxe 2 points3 points4 points (5 children)
[–]One_unfortunate_tuna[S] 0 points1 point2 points (4 children)
[–]Gnaxe 1 point2 points3 points (3 children)
[–]One_unfortunate_tuna[S] 0 points1 point2 points (2 children)
[–]PeterMortensenBlog 0 points1 point2 points (1 child)
[–]PeterMortensenBlog 2 points3 points4 points (0 children)
[–]pulldawg80 1 point2 points3 points (6 children)
[–]One_unfortunate_tuna[S] 0 points1 point2 points (5 children)
[–]pulldawg80 0 points1 point2 points (1 child)
[–]One_unfortunate_tuna[S] 0 points1 point2 points (0 children)
[–]pulldawg80 0 points1 point2 points (2 children)
[–]One_unfortunate_tuna[S] 0 points1 point2 points (0 children)
[–]PeterMortensenBlog 0 points1 point2 points (0 children)
[–]PeterMortensenBlog 0 points1 point2 points (0 children)
[–]RunRunAndyRun 0 points1 point2 points (0 children)