I have 2 x 4x4 Keypads that are connected to two Seperate PCF8574AP Chips. Each set to a different address.
I’m using this library:
The Library works perfectly fine when using only one instance (One Keypad).
At first I couldn’t get the library to work at all with two instances. So I made a small modification to the Library as follows:
private: void pcf8574_write(int, int); int pcf8574_byte_read(int); };
private: void pcf8574_write(int, int); int pcf8574_byte_read(int); int pcf8574_i2c_addr; };
Then in “i2ckeypad.cpp”, I commented out the line:
// PCF8574 i2c address // int pcf8574_i2c_addr;
It now works “somewhat” with two instances.
i am now able to access both keypads, however under the serial monitor, when I press a key once, the key is displays over 20 times per keypress. It should only display each keypress once.
I also noticed if I add a 30ms delay between the checking the two instance, the amount of times it shows in the serial monitor is cut down from 20 to about 5 displays per keypress.
I have attached a zip file with the modified library and a working (One Instance) and non-working (Two Instances) example sketch as well as pictures of the Serial Terminal Output.
Does anybody have any idea how to fix this issue?
i2ckeypad.zip (70.5 KB)