An Tran
Published © MIT

Particle Photon + Matrix Keypad + LCD using I2C

Use a matrix key pad as input and LCD as output for particle photon

BeginnerProtip1 hour1,976
Particle Photon + Matrix Keypad + LCD using I2C

Things used in this project

Hardware components

Photon
Particle Photon
×1
Seeed Studio Grove - LCD RGB Backlight
×1
Membrane Matrix Keypad
×1
Resistor 4.7k ohm
×1

Story

Read more

Schematics

Schematic

Code

Firmware

C/C++
#include "Keypad_I2C.h"
#include "Grove_LCD_RGB_Backlight.h"

rgb_lcd lcd;

const int colorR = 100;
const int colorG = 100;
const int colorB = 100;

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char* I2CTYPE = "Adafruit_MCP23017";

char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {6, 5, 4, 3}; //row pins
byte colPins[COLS] = {2, 1, 0}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS, I2CTYPE );

void setup() {
    Serial.begin(9600);

    // set up the LCD's number of columns and rows:
    lcd.begin(16, 2);

    // Set up background backlight color
    lcd.setRGB(colorR, colorG, colorB);

    lcd.print("hello, world!");
}

void loop() {
    char key = keypad.getKey();
    if (key) {
        Serial.println(key);
        lcd.setCursor(0,1);
        lcd.print(key);
    }
}

Source

Credits

An Tran

An Tran

5 projects • 12 followers
tech, startup, web, mobile, iot, dev

Comments