modifying libraries
i planning keypad library in sketch, i'm unshure if have asign pins in keypad.cpp file or in sketch. array keymapping:
// 4x4 keypad key mapping. shouldn't need touch unless have
// keypad different (or more) keys listed.
const char keymap[4][5] = { "123a",
"456b",
"789c",
"*0#d" };
if want make bigger matrix, how that? should change keymap array again in .cpp file , let ide recompile? should define matrix , array in sketch or should try make copy of lib , modify that?
al multidimensional arrays bit confusing. looking @ example above, result of
keymap[1][4]
or
keymap[4][1]
sorry question-mix
// 4x4 keypad key mapping. shouldn't need touch unless have
// keypad different (or more) keys listed.
const char keymap[4][5] = { "123a",
"456b",
"789c",
"*0#d" };
if want make bigger matrix, how that? should change keymap array again in .cpp file , let ide recompile? should define matrix , array in sketch or should try make copy of lib , modify that?
al multidimensional arrays bit confusing. looking @ example above, result of
keymap[1][4]
or
keymap[4][1]
sorry question-mix
it may think of value in first bracket number of rows , second bracket value in each column.
keymap[1][4] 1 row of 4 characters (3 plus trailing 0 terminates string)
or
keymap[4][1] 4 rows of 1 character
so make keymap of 6 rows have:
keymap[6][5] = {"123a",
"456b",
"789c",
"*0#d",
"ghij",
"klmn"};
to make each of 4 rows of keymap have 7 characters ( 6 characters plus terminating 0)
keymap[4][7] = {"123abc",
"456bcd",
"789cde",
"*0#def" };
keymap[1][4] 1 row of 4 characters (3 plus trailing 0 terminates string)
or
keymap[4][1] 4 rows of 1 character
so make keymap of 6 rows have:
keymap[6][5] = {"123a",
"456b",
"789c",
"*0#d",
"ghij",
"klmn"};
to make each of 4 rows of keymap have 7 characters ( 6 characters plus terminating 0)
keymap[4][7] = {"123abc",
"456bcd",
"789cde",
"*0#def" };
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > modifying libraries
arduino
Comments
Post a Comment