Keypad library duplicated columns

Hi,
I have 4x4 matrix keypad in layout
1 2 3 A
4 5 6 B
7 8 9 C

  • 0 # D
    And I’m using Keypad library.
    However, the library uses first’s coulmn keys for the last one, so the keypad works like this:
    1 2 3 1
    4 5 6 4
    7 8 9 7
  • 0 # *
    I tried different keypad, even disconnecting everything and just joining wires to make sure, no combination produced A/B/C/D. I also tried changing the keymap to make sure there is no problem with the letters, but still nothing.
    Just in case, this is code(library’s example)
#include <Keypad.h>
const byte ROWS = 4; 
const byte COLS = 4; 
char hexaKeys[ROWS][COLS] = {
  {'1','2','3','a'},
  {'4','5','6','b'},
  {'7','8','9','c'},
  {'*','0','#','d'}
};
byte rowPins[ROWS] = {6,7,8,9};
byte colPins[COLS] = {10,11,12,13};
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
void setup(){
  Serial.begin(9600);
}  
void loop(){
  char customKey = customKeypad.getKey();  
  if (customKey){
    Serial.println(customKey);
  }
}

I’m using this library http://playground.arduino.cc/Code/Keypad version 3.1.1
Any suggestions?
Thanks.

But what hardware are you using and how is it wired up?

Grumpy_Mike: But what hardware are you using and how is it wired up?

http://www.ebay.com/itm/4-x-4-AVR-16-Key-Matrix-Array-For-Arduino-HOT-Membrane-Switch-Keypad-Keyboard-/331913224309?hash=item4d4791e075:g:a2YAAOSwayZXjn1V Rows are wired to pins 6, 7, 8 and 9 Columns are wired to pins 10, 11, 12 and 13

As I said, it's not problem of wiring. I even tried simply joining the wires withou keypad, the library produces wrong keys for the last column. And For each wire, I tried connecting all of the 7 others and NONE of these combinations produced any key from the last collumn, only the firts collumn was produced twice. Wiring is fine, problem is with the library.

problem is with the library.

And you think no one has spotted this before and you have just discovered it?

Well the problem is that your wiring / key pad is not designed in the same way as that libiary was meant to cope with.

So what you do is to write down what key values you get against what the key value should be. In that way you can work out what is wrong with your wiring. Sure you might be able to fix it by changing the code but who can tell without the report of what you are actually getting against what you are expecting.

Grumpy_Mike: And you think no one has spotted this before and you have just discovered it?

Well the problem is that your wiring / key pad is not designed in the same way as that libiary was meant to cope with.

So what you do is to write down what key values you get against what the key value should be. In that way you can work out what is wrong with your wiring. Sure you might be able to fix it by changing the code but who can tell without the report of what you are actually getting against what you are expecting.

It mus be something with the compiling. I know how multiplexing works and I know how to connect them. And if you think the library is right, than why none of the combinations when I was manually connecting all of the pins together produced the last collumns? I've been using this library for a year, but only with 4x3 keypads.

Another proof that somethign goes wrong while compiling. When I use the library with Arduino MEGA 2560, it works fine. But on Arduino Duemilanove, the last collumn is wrong. Any ideas how to fix it?

parmanik: Another proof that somethign goes wrong while compiling. When I use the library with Arduino MEGA 2560, it works fine. But on Arduino Duemilanove, the last collumn is wrong. Any ideas how to fix it?

It might also indicate that something is wrong with your duemilanove.