Skip to content

Instantly share code, notes, and snippets.

@AdamLoi
Created March 10, 2014 14:55
Show Gist options
  • Save AdamLoi/9466517 to your computer and use it in GitHub Desktop.
Save AdamLoi/9466517 to your computer and use it in GitHub Desktop.
#include <Wire.h>
#include <i2ckeypad.h>
#define ROWS 4
#define COLS 3
// With A0, A1 and A2 of PCF8574 to ground I2C address is 0x38
#define PCF8574_ADDR 0x38
i2ckeypad kpd = i2ckeypad(PCF8574_ADDR, ROWS, COLS);
void setup()
{
Serial.begin(9600);
Wire.begin();
kpd.init();
Serial.print("Testing keypad/PCF8574 I2C port expander arduino lib\n\n");
}
void loop()
{
char key = kpd.get_key();
if(key != '\0') {
Serial.print(key);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment