Menu

need help with 10x11 matrix

Anonymous
2023-11-08
2024-02-19
  • Anonymous

    Anonymous - 2023-11-08

    So I've been trying to figure this out its an arachnid board
    has 10x11 ribbon .
    When I go through setup 20 and 1 doesn't register
    I'm using a mega 2560
    Heres what i upload to it
    Any help would be appreciated
    Thanks
    Chris

    / @file CustomKeypad.pde
    || @version 1.0
    || @author Alexander Brevig
    || @contact alexanderbrevig@gmail.com
    ||
    || @description
    || | Demonstrates changing the keypad size and key values.
    || #
    /
    /#include <keypad.h>
    </keypad.h>
    /
    const byte numRows = 10; //four rows
    const byte numCols = 11; //four columns
    const int debounceTime = 100;//20 works better than great !
    //define the cymbols on the buttons of the keypads
    char keymap[numRows][numCols] = {
    {'0','1','2','4','5','6','7','8','9','*'},
    {'a','b','c','d','e','f','g','h','i','?'},
    {'j','k','l','m','n','o','p','q','r','&'},
    {'s','t','u','v','w','x','y','z','A','@'},
    {'B','C','D','E','F','G','H','I','J','}'},
    {'K','L','M','N','O','P','Q','R','S',')'},
    {'T','U','V','W','X','Y','Z','+','-',']'},
    {'/','!','$','#','(','=','[','_','<','>'}
    };
    byte rowPins[numRows]
    = {30, 32, 34, 36, 38, 40, 42, 44, 46, 48}; //connect to the row pinouts of the keypad
    byte colPins[numCols] = {31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51}; //connect to the column pinouts of the keypad

    //initialize an instance of class NewKeypad
    /Keypad customKeypad = Keypad( makeKeymap(Keys), rowPins, colPins, ROWS, COLS);
    /
    void setup()
    {
    Serial.begin(9600);
    for (int row = 0; row < numRows; row++)
    {
    pinMode(rowPins[row],INPUT); // Set row pins as input
    digitalWrite(rowPins[row],HIGH); // turn on Pull-ups
    }
    for (int column = 0; column < numCols; column++)
    {
    pinMode(colPins[column],OUTPUT); // Set column pins as outputs
    // for writing
    digitalWrite(colPins[column],HIGH); // Make all columns inactive
    }
    }

    void loop()
    {
    char key = getKey();
    if( key != 0) { // if the character is not 0 then
    // it's a valid key press
    /Serial.print("Got key ");/
    Serial.print(key);
    }
    }

    // returns with the key pressed, or 0 if no key is pressed
    char getKey()
    {
    char key = 0; // 0 indicates no key pressed

    for(int column = 0; column < numCols; column++)
    {
    digitalWrite(colPins[column],LOW); // Activate the current column.
    for(int row = 0; row < numRows; row++) // Scan all rows for
    // a key press.
    {
    if(digitalRead(rowPins[row]) == LOW) // Is a key pressed?
    {
    delay(debounceTime); // debounce
    while(digitalRead(rowPins[row]) == LOW)
    ; // wait for key to be released
    key = keymap[row][column]; // Remember which key
    // was pressed.
    }
    }
    digitalWrite(colPins[column],HIGH); // De-activate the current column.
    }
    return key; // returns the key pressed or 0 if none
    }

     
    • Huub Laan

      Huub Laan - 2024-02-19

      Can you tell me the type of the arachnid board? As the matrix of a "professional" Arachnid board is 11x8. There is space in the 6th row (pin 14 on the board connector) to connect the phisical buttons to.

       
    • Huub Laan

      Huub Laan - 2024-02-19

      Hi Chris,

      Thinking that you might have used a different matrix I started looking into your code. I've seen you correctly adjusted the number of rows and collumns. You changed the input pins of those as well.

      However you did not expand the lookup table to 10 rows and 11 collums, so everytime you hit a number outside the 8x10 matrix no payload was send over the serial connection. So it would not register.

      Please try this code and let me know if it works, I had to get a little crazy with the symbols since 10x11 is quite a large matrix. I don't know if this is supported or not. If not please try different symbols until it works. (you can test the connection in de serial monitor build in to the arduino IDE)

      / @file CustomKeypad.pde
      || @version 1.0
      || @author Alexander Brevig
      || @contact alexanderbrevig@gmail.com
      ||
      || @description
      || | Demonstrates changing the keypad size and key values.
      || #
      /
      /#include <keypad.h>
      </keypad.h>/
      const byte numRows = 10; //four rows
      const byte numCols = 11; //four columns
      const int debounceTime = 100;//20 works better than great !
      //define the cymbols on the buttons of the keypads
      char keymap[numRows][numCols] = {
      {'0','1','2','4','5','6','7','8','9','-','='},
      {'!','@','#','$','%','^','&','*','(',')','_'},
      {'+','~','`','q','w','e','r','t','y','u','i'},
      {'o','p','[',']','{','}','\','|','a','s','d'},
      {'f','g','h','j','k','l',';',':',''','"','z'},
      {'x','c','v','b','n','m',',','<','.','>','/'},
      {'?','Q','W','E','R','T','Y','U','I','O','P'},
      {'A','S','D','F','G','H','J','K','L','Z','X'},
      {'C','V','B','N','M','₿','₾','₽','₼','₻','₺'},
      {'₹','₸','₷','₶','₵','₴','₳','₲','₱','₰','₯'},
      {'₮','₭','€','₫','₪','₩','₨','₧','₦','₥','₤'},
      };
      byte rowPins[numRows] = {30, 32, 34, 36, 38, 40, 42, 44, 46, 48}; //connect to the row pinouts of the keypad
      byte colPins[numCols] = {31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51}; //connect to the column pinouts of the keypad

      //initialize an instance of class NewKeypad
      /Keypad customKeypad = Keypad( makeKeymap(Keys), rowPins, colPins, ROWS, COLS);
      /
      void setup()
      {
      Serial.begin(9600);
      for (int row = 0; row < numRows; row++)
      {
      pinMode(rowPins[row],INPUT); // Set row pins as input
      digitalWrite(rowPins[row],HIGH); // turn on Pull-ups
      }
      for (int column = 0; column < numCols; column++)
      {
      pinMode(colPins[column],OUTPUT); // Set column pins as outputs
      // for writing
      digitalWrite(colPins[column],HIGH); // Make all columns inactive
      }
      }

      void loop()
      {
      char key = getKey();
      if( key != 0) { // if the character is not 0 then
      // it's a valid key press
      /Serial.print("Got key ");/
      Serial.print(key);
      }
      }

      // returns with the key pressed, or 0 if no key is pressed
      char getKey()
      {
      char key = 0; // 0 indicates no key pressed

      for(int column = 0; column < numCols; column++)
      {
      digitalWrite(colPins[column],LOW); // Activate the current column.
      for(int row = 0; row < numRows; row++) // Scan all rows for
      // a key press.
      {
      if(digitalRead(rowPins[row]) == LOW) // Is a key pressed?
      {
      delay(debounceTime); // debounce
      while(digitalRead(rowPins[row]) == LOW)
      ; // wait for key to be released
      key = keymap[row][column]; // Remember which key
      // was pressed.
      }
      }
      digitalWrite(colPins[column],HIGH); // De-activate the current column.
      }
      return key; // returns the key pressed or 0 if none
      }

      Some dartboards even have diferent alocations for the inner single 20 and outer single 20. (and all of the other numbers)

      the way I solved this was placing the same character in the lookup table.
      

      Kind regards,
      Huub

       

      Last edit: Huub Laan 2024-02-19
  • Huub Laan

    Huub Laan - 2024-02-19

    Hi, hope you did not give up on this project allready, I had it working a few years ago with a Arachnid Galaxy 1 Cabinet. Let me dig in to my back ups to see what my code used to look like.

     

Anonymous
Anonymous

Add attachments
Cancel