In my project using a Mega2560, I have attached a 4x4 keypad directly to A0-A7 pins.
(No pull up resistors or other paraphernalia)
Using the keypad library, its working.
When I built a standalone version of the same on a PCB, its not working any more.
The Mega2560 is getting programmed. I have verified by taking the .hex for the blink program and uploading it. There is no problem.
This is the code I'm using to test :
(I want to toggle an LED, everything a button is pressed. This code is working fine on the arduino board)
#include <Keypad.h>
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] = {A7, A6, A5, A4};
byte colPins[COLS] = {A3, A2, A1,A0};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int statuspin=0;
int led = 2;
void setup(){
pinMode(led, OUTPUT);
}
void loop(){
keypad.waitForKey();
digitalWrite(led, !digitalRead(led));
}