[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 

This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Using the Menu with a Matrixkeyboard RSS feed
Forum Index » tcMenu Arduinio library
Author Message

Joined: Oct 21, 2020
Messages: 19
Hi, i am using the tcMenu library on a Df_Robot-Shield, everything is working fine.
Now i wanna use another keypad, a maxtrix keypad with 5 Buttons: Up, Down, Left, Right, Select. Ok, i know that i don't need the Left and the right button.
I tested the keypad with an example of the TaskManagerIO-Library, everything is ok.
How can i use the keypad instead of the buttons of the Df_Robot-Shield ?
How can i "tell" the MenuManager which button is for uo, which for dwon and which for select ?
#include <KeyboardManager.h>
#include <tcMenuKeyboard.h>

const char pgmLayout[] PROGMEM = "LRUDS";
KeyboardLayout keyLayout(1, 5, pgmLayout);
MatrixKeyboardManager keyboard;

MenuEditingKeyListener menuKeyListener;

extern AnalogMenuItem menuCurrent;
extern AnalogMenuItem menuVoltage;
extern AnalogMenuItem menuADCount;
extern AnalogMenuItem menuIst;
extern AnalogMenuItem menuSmooth;
extern EnumMenuItem menuCompMode;
extern AnalogMenuItem menuMaxwert;
extern AnalogMenuItem menuBuerde;
extern AnalogMenuItem menuMessage;
extern AnalogMenuItem menuDelay;
extern AnalogMenuItem menuCoOff;
extern AnalogMenuItem menuCoOn;
extern BooleanMenuItem menuRunStatus;
extern AnalogMenuItem menuDruck;

void setup() {
    Serial.begin (9600);
    keyLayout.setRowPin(0, 27);
    keyLayout.setColPin(0, 22);
    keyLayout.setColPin(1, 23);
    keyLayout.setColPin(2, 24);
    keyLayout.setColPin(3, 25);
    keyLayout.setColPin(4, 26);

    // create the keyboard mapped to arduino pins and with the layout chosen above.
    // it will callback our listener
    keyboard.initialise(ioUsingArduino(), &keyLayout, &menuKeyListener);

    // start repeating at 850 millis then repeat every 350ms
    keyboard.setRepeatKeyMillis(850, 350);

    Serial.println("Keyboard is initialised!");


void loop() {

Joined: Jan 19, 2019
Messages: 686
You could use the regular tcMenu matrix keyboard support class, there's an example that shows it's use in KeyboardEthernet or something similarly named in the examples.

That would be the quickest way to get things working, and if you wanted something more custom than that could provide, you could use it as a starting point to write something of your own.

With a 4x4 arrangement, someone recently submitted a patch that uses the A and B keys to do the up and down, * and # are used to start edits and reset. Admittedly it's not super well documented at the moment, but it's on the list to fully document soon.

Maybe take a look at:


Does that do what you want?

Joined: Jan 19, 2019
Messages: 686
BTW You can also use the keyboard support along with a rotary encoder or the dfrobot shield. We often do that. Otherwise choose no input in the designer, then add the code as described in the keyboard article.
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.