Skip to content

keyboard special keys #309

Answered by tomelgato
tomelgato asked this question in Q&A
Feb 28, 2023 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

A complete and working example for a 5x4 keyboard incl. custom key listener extension:

#include <tcMenuKeyboard.h>

// custom definition for 5x4 keyboard
const char KEYBOARD_STD_5X4_KEYS[] PROGMEM = "WXYZ123A456B789#L0R*";
KeyboardLayout keyLayout(5, 4, KEYBOARD_STD_5X4_KEYS);

MatrixKeyboardManager keyboard;

class MyKeyboardListener : public MenuEditingKeyListener {
	public:
		void keyPressed(char key, bool held) {
			// do something when pressed
			switch (key) {
				case char('W'):
					Serial.println("W Key pressed");
                                    break;
				default:
					// pass other keys to TCMenu
					MenuEditingKeyListener::keyPressed(key,held);
					break;
			}
		}
		void…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@tomelgato
Comment options

Comment options

You must be logged in to vote
1 reply
@tomelgato
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by davetcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants