keypad issue

Hi wondering you you can help me

having a play and finding the keyboard isnt working on all numbers

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns

char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'},
};
byte rowPins[ROWS] = {5, A5, A4, A2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A1, A0, A3}; //connect to the column pinouts of the keypad

i think i know the issue i dont have enough spare ways on my uno to connect pin 8 y from my keypad

i have the a,b,c,d on it as well.

is there a way to get around this or is it simply buy a 4 row 3 column keypad?

laurencekay:
i dont have enough spare ways on my uno to connect pin 8 y from my keypad

i have the a,b,c,d on it as well.

is there a way to get around this or is it simply buy a 4 row 3 column keypad?

You can make the following changes to add another column:

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns

char keys[ROWS][COLS] = {
  {'1','2','3','a'},
  {'4','5','6','b'},
  {'7','8','9','c'},
  {'*','0','#','d'},
};
byte rowPins[ROWS] = {5, A5, A4, A2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A1, A0, A3, A4}; //connect to the column pinouts of the keypad

I'm not sure if the A4 pin is available on the UNO, I just made it up. You can pick any other pin that is available and it should work.

thanks did think about that but currently only have following spaces free

vin, grd, 3.3v, eset, ioref, rx 0, tx 1 , aref

guess none of those can be used?

Just as I hit the post button I realized I may have missed that point. :wink:

But you still might be able to make this work. I wrote the keypad library so that it can share (or multiplex) pins with other hardware. The LiquidCrystal library also has that ability so the keypad and LCD can share the data pins. Do you have an LCD connected to your UNO?

If not then you might be able to share pins with something else that you have connected. Could you provide a schematic or drawing showing how everything is connected?

Yep have LCD screen. i have just ordered a 3x4 keypad think it might be the easiest way to sort this while i am still learning!

for ref have LCD / keypad connected as well as 3 leds and a buzzer so using all pins up! either need bigger arduino board or the smaller keypad :slight_smile:

Thank you for all your help

You can probably save your money. Try connecting the ROW pins of your keypad and the DATA pins of the LCD to the same Arduino pins. It should just work.

If you do this then you'll still have 3 pins left over. :slight_smile: