Menu

Karella Dart CB 90

Arne
2018-02-15
2018-02-16
  • Arne

    Arne - 2018-02-15

    Hi there,
    I want to post my "14x7" Dartboard config.
    The "problem" was the big matrix cause the inner single circle is different the other one.
    i got the arduino mega for it, and doubles some keys.

    /* @file CustomKeypad.pde
    || @version 1.0
    ||
    || @description
    || | Demonstrates changing the keypad size and key values.
    || #
    */
    /*#include <Keypad.h>
    */
    /* 
    Note : This file should be adapted to your the wires that you havec connected to your arduino controler !
    */
    const byte numRows = 7; //for rows
    const byte numCols = 14; //for 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','3','4','5','6','7','8','9','*','a','b','c'},
    {'d','e','f','g','h','i','j','k','l','m','n','o','p','r'},
    {'s','t','2','3','w','x','y','k','l','m','C','D','E','F'},
    {'G','H','I','J','K','L','M','N','O','P','R','S','T','U'},
    {'d','t','X','Y','Z','5',')','!','§','v','C','a','/','['},
    {'0','=','?','z','A','i','@','%','V','+','-','o','W','²'},
    {'³','1','X','Y','B','½','&','!','§','v','n','>','u',']'}
    };
    byte rowPins[numRows] = {31, 33, 35, 37, 39, 41, 43}; //connect to the row pinouts of the keypad
    byte colPins[numCols] = {22, 24, 26, 28, 30, 32 ,34, 36, 38, 40, 42, 44, 46, 48}; //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
    }
    
     
  • Andreas

    Andreas - 2018-02-16

    Good JOB

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.