Go Down

Topic: Matrix KeyPad interface isssue (Read 588 times) previous topic - next topic

Mogaraghu

Using a UNO and a reading a 4 x 4 Matrix keypad. All well.  But the moment I plug in a Ethernet Shield ( W5100 ) the KeyPad code does not work and permanently sends the key "C" which corresponds to the Row 4 and Col 1 location. ( Pin 8 ).

As I can see Pin 8 is not used in the Ethernet Shield- could there be a board problem ? ( The Ethernet board itself is working OK for communications ). The keypad code is below
Code: [Select]


/* @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>

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] = {
  {'A','1','2','3'},
  {'B','4','5','6'},
  {'C','7','8','9'},
  {'D','E','0','F'}
};

byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6, 7, 8, 9};  //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);
  }



What is wrong ?

Peter_n

The Ethernet Shield uses the SPI bus, and pin 10 for chip-select for the W5100 and pin 4 for chip-select for the SD.

Use another pin for pin 4.

Go Up