KEY MATRIX with Mobiflight #451
ismailsurek
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
i will investigate the key matrix more, but at the moment it will be low priority. We are adding shift registers and multiplexer first. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All Friend
i am using Key matrix into both FMC with Lua script
is this function can be possible to set by mobiflight _?
example arduino code ;
#include <Keypad.h>
const byte ROWS = 11;
const byte COLS = 8;
byte keys[COLS*ROWS] = {
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,
47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88
byte rowPins[ROWS] = {38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48};
byte colPins[COLS] = {30, 31, 32, 33, 34, 35, 36, 37};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
unsigned long previousMillis = 0;
const long interval = 50;
String turnon = "T";
String turnoff = "S";
const unsigned int MAX_INPUT = 21;
byte data;
byte i;
void process_data (const char * adata)
{
String temp = "";
int datasize = strlen(adata);
int datacount = datasize / 2;
for (int i=0; i<datacount; i++)
{
for (int j=0; j<2; j++)
{
char c = adata[(i*2+j)];
temp = temp + c;
}
process_var(temp);
temp = "";
}
}
void processIncomingByte (const byte inByte)
{
static char input_line [MAX_INPUT];
static unsigned int input_pos = 0;
switch (inByte)
{
case '\n':
input_line [input_pos] = 0;
process_data (input_line);
input_pos = 0;
break;
case '\r':
break;
default:
if (input_pos < (MAX_INPUT - 1))
input_line [input_pos++] = inByte;
break;
}
}
void loop()
{
while (Serial.available () > 0)
processIncomingByte (Serial.read ());
unsigned long currentMillis = millis();
if ((currentMillis - previousMillis) >= interval)
{
byte key = keypad.getKey();
if (key != NO_KEY) {
//Serial.println(key); // Prints the number of the button
switch ((int)key)
{
case 71:
Serial.println("EVT_CDU_L_L1");
break;
case 72:
Serial.println("EVT_CDU_L_L2");
break;
case 69:
Serial.println("EVT_CDU_L_L3");
break;
....... ..... ..... ..... . .. ..
// Event = (int)key;
}
}
LUA script
function Serial_Data(Serial_Com_Port, datastring, length)
print("----COM-----", port_number)
print(datastring)
eventid = 0
if ipc.readSTR(0x3500,3) == "B73" then
if (string.find(datastring, "EVT_CDU_L_L1")) then
eventid = 534
end
if (string.find(datastring, "EVT_CDU_L_L2")) then
eventid = 535
Beta Was this translation helpful? Give feedback.
All reactions