Interfacing membrane keypad with arduino uno

hello, there i got a problem interfacing membrane keypad with arduino uno r3. I have borrowed the code from customkeypad example.The problem is a row (7,8,9,c) seems to be not working. the code i have used is below:

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'0','1','2','3'},
{'4','5','6','7'},
{'8','9','A','B'},
{'C','D','E','F'}
};
byte rowPins[ROWS] = {3, 2, 1, 0}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
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 have connected R1,R2,R3,R4,C1,C2,C3,C4 to digital pins 3,2,1,0,7,6,5,4 respectivley

The Arduino Uno uses pin 0 (RX) and pin 1 (TX) to communicate with the computer.

So where can i connect instead and what does byte rowpins[col] do?

So pins 0 and 1 cannot be used for any other purpose other than to communicate with the computer

skopize:
So where can i connect instead and what does byte rowpins[col] do?

Pick any pins you aren't using for anything else. When you call Serial.begin() on an Arduino UNO you are using pins 0 and 1 for serial I/O. That array, spelled "byte rowPins[ROWS]", lists the pins to which you have the rows connected.

skopize:
So pins 0 and 1 cannot be used for any other purpose other than to communicate with the computer

If you use them for serial I/O you can't also use them for digital inputs and outputs. If you were using an Arduino Leonardo then Serial works via USB directly and Serial1 goes through pins 0 and 1. Your sketch would have worked on an Arduino Leonardo.

Thanks for the reply. :slight_smile: but how do you connect pin 0 and pin1 to a computer.I mean doesnt the arduino communicate with the computer using usb?

Yes, pin 0 and pin 1 (and also reset) go to a usb-serial chip near the usb connector. That is connected to the computer via usb.
The pin 0 and pin 1 are the RX and TX of the ATmega328P, that is the microcontroller that is used in the Arduino Uno. The microcontroller executes the sketch.

computer ---- usb cable ---- usb serial chip ---- ATmega328P

Thanks by the way after connecting the keypad to pins other than 1 and 0 it now works fine ;D