• Wow, that's a great idea! What type of computer are you planning on connecting it to? Currently the Pico can pretend to be a Keyboard on Mac, Android and Linux really well, but Windows doesn't pick it up. That'll be fixed in some future firmware update though.

    But otherwise, yes - you can connect a button to each GPIO pin, but you can go one better. You can 'matrix' the buttons - you basically wire them up in a grid, with rows connected to one side of the buttons, and columns to the other (obviously they don't actually need to be physically arranged in a grid - just wired that way). It's what keyboards do, and means that with N + M wires, you can connect N * M buttons. So with 22 wires you could manage 11*11 = 121 buttons :)

    There's actually a library to handle it nicely: http://www.espruino.com/KeyPad

    The only thing to watch out for is that if multiple buttons are pressed at once, it can get confused. As you're making an arcade controller that's a real possibility, so you can put one diode on each button - there's an article on it here: https://electrosome.com/reading-multiple­-pressed-keys-matrix-keypad-pic-microcon­troller/

    I don't think it actually makes any different to how your read the data, it just means you don't get 'ghost' keys pressed.

    ... the buttons you posted links to look like they'd be fine though.

    Hope that helps!

About

Avatar for Gordon @Gordon started