Nodemcu v3.0 esp8266 and keypad 3x4 and lcd

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?

Not using parts correctly. The backpack assembly was designed to control the display, not do the display and read a keyboard. You can get an additional PCF857x (x=4 or 5 and it can have an A) for the keyboard it will work great. It can be the same part wired differently. It must have a different I2C address.

Did you read this tutorial to the end?
Did you see that in his pseudo schematic he uses another module?

Thank you.

Yes I did, maybe I should've tested the pins first but I don't know how to do that.

Just bought one of these https://pt.aliexpress.com/item/32895217578.html hope it works

it worked

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.