Hi,
I want to connect my LCD(sbc-lcd16x2 joy it) and keypad( Whadda WPI300 3x4) together. I found a way to do throught the LCD I2C backpack (https://www.brainy-bits.com/post/a-keypad-lcd-with-only-2-pins-no-problem-with-the-i2c-protocol)
I connected all my pins of keypad to the I2C backpack
And I'm trying to use this code for starting
/* @file HelloKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates the simplest use of the matrix Keypad library.
|| #
*/
#include <Keypad_I2C.h>
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] = {D0, D3, D4, D5}; // ESP8266 pins connect to the row pins
byte colPins[COLS] = {D6, D7, D2}; // ESP8266 pins connect to the column pins
Keypad_I2C Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS, 0x20, PCF8574 );
void setup(){
Serial.begin(9600);
}
void loop(){
char key = Keypad.getKey();
if (key){
Serial.println(key);
}
}
But for some reason, I don't get any keys. If I connect the keypad directly to the nodemcu, it works. I tried using a I2C scanner and the only address I get is from the LCD.
What am I doing wrong?