Created
March 10, 2014 14:55
-
-
Save AdamLoi/9466517 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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