MobaTools - Buttons, Max32 etc

Hi
Need some advice on using this MobaTools Example Sketch:

https://github.com/MicroBahner/MobaTools/blob/master/examples/_Buttons/PrintStates2/PrintStates2.ino

Using a Nano so not many io available. I want to use 20 buttons, to select stepper positions.

Want to use a keypad matrix 4x5, and multiplexer 74HC165.

Question1: Is there a example sketch out there that uses MAX32 and keypad matrix?
Question2: How ( or do I need) to use the 74HC165.. Or does the button library cover the multiplexing somehow.

Thankyou
Charles

Let's ask an expert: @MicroBahner

There's the function "Search Forum" in this window, up to the right, Google and IDE example code to visit.

Using another controller or reconcidering the panel is an option.

The library documentation surely tells what the library provide and what it needs.

Hi Railroader
Thanks for your input. Have done some Googling and did not manage to locate anything on using the Matrix and multiplexer with MT.
Will consider changing boards. Maybe go to Uno or Mega. With plenty of pins.
Checked thru the documentation on MT Buttons. There is mention of matrix but no examples in use etc.
Thnks

The 74HC165 isn't a multiplexer but simply a shift register (parallel in -> serial out ). But you can use it to save input pins.

There is an example with a matrix. But unfortunately it is only 4x4 and it uses an I2C expander (PCF8574) to save pins. But it could be a better start than the example you linked. With two PCF8574 it should be fairly easy to extend the example to a 5x4 matrix. ( maybe worth an additional example with >16 buttons ... :thinking: )

As already stated, the HC165 is only pi-so shift register. I would recommend to use a I2C IO expander. That needs the least Nano pins (only 2 ).

The library itself does no multiplexing. That has to be done in the callback ( see the example linked above - it is a matrix example).

The UNO does not have more IO pins than the Nano. With an Mega it would be possible without IO-expander - even without multiplexing at all. But the I2C solution would fit for a Nano too ( only 2 pins ), and if the rest of the Nano pins is sufficent for your project, I don't see you need to switch to a Mega.

[EDIT] There is also the PCF8575, which is a 16-bit IO expander. So you need only one I2C device for your matrix. The PCF8575 is available as breakout board for easy connection.

1 Like

To extend it from 4x4 to 5x4 you need only one pin more - maybe possible to use a pin from the Nano directly. So you need 3 Nano pins and one PCF 8574 for your keypad ( and a small extension of the example ).
It's up to you which HW version you prefer :wink:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.