LCD Nokia 5110 + sistem Arduino

[ [ images, codes & links ] ]

The Nokia 5110 display has long been an Arduino Hobbyist favorite and a search of the internet will show that there are tons of different ways to drive this device.

There are a few varieties of this module are out there.   Mine are labeled as you see below.   Others should work just fine with this tutorial if you map your pins correctly.

Remember,  VCC is 3.3 Volts.   The LIGHT Control can use pulse width modulation through a 330 ohm resistor.

https://sunupradana.info/tkr/wp-content/uploads/2017/07/Nokia-5110-Pinouts.png

Gambar 1.

 

~Arduino Nokia 5110 with U8GLIB Tutorial

 

LCD Specifications

  • Controller: PCD8544
  • Supply: 2.7V to 3.3V
  • Interface levels: 2.7V to 5V
  • Backlight Colour: Blue
  • Backlight supply: 3.3V Max
  • Module size: W 43.6mm x H 43.1mm
  • Working current: < 200uA (Backlight off)

Notice that the module only needs 3.3v from the Arduino. More information can be found on the Datasheet located here.

nokiaGambar 2. [sumber]

lcdGambar 3. [sumber]

~hackshed.co.uk

Koneksi pada Gambar 3 hanya contoh, pin pada Arduino dapat diatur sesuai keperluan dan dukungan pustaka.

Gambar 4.

 

Untuk penggunaan LCD Nokia 5110, salah satu pustaka yang bisa dipergunakan adalah u8glib (atau versi yang lebih baru u8g2). Sebagai contoh untuk uji coba, dapat diikuti kode program dari: henrysbench.capnfatz.com berikut:

// Henry's Bench
// Arduino Nokia 5110 U8Glib Tutorial


#include "U8glib.h"

 

#define backlight 11
 
//Delcare the display and assign the pins
 
//U8GLIB_PCD8544 u8g(8, 4, 7, 5, 6);  // CLK=8, DIN=4, CE=7, DC=5, RST=6
 
 
U8GLIB_PCD8544 u8g(8, 4, 7, 5, 6);  // CLK=8, DIN=4, CE=7, DC=5, RST=6

 
void draw() {
 
  u8g.setFont(u8g_font_profont11);  // select font
  u8g.drawStr(0, 15, "Nokia 5110..");  // put string of display at position X, Y
  u8g.drawStr(29, 35, "HELLO!!!!");
  
  
}
 
void setup() 
{
  // Set Backlight Intensity
  // 0 is Fully bright
  // 255 is off
  analogWrite(backlight, 20);
  //
  // Enter the U8Glib Picture Loop
  //
  
}
 
void loop() 
{ 
 u8g.firstPage(); 
  do 
  {
    draw();
  } while( u8g.nextPage() ); 
  
}

Salah satu pustaka/library yang umum dipergunakan untuk LCD Nokia 5110 adalah pustaka  yang dikeluarkan oleh Adafruit. Terdapat dua bagian pustaka untuk lcd ini, satu adalah untuk driver hardware dan satu untuk pustaka grafik.

Urutan pin LCD 5110 pada produk Adafruit bisa jadi tidak sama dengan urutan pin LCD 5110 yang bisa dibeli di pasaran lokal (impor dari China). Meskipun begitu, pustaka dapat dipergunakan dan berfungsi secara normal.

 

Testing

You can find our Nokia Display Arduino library on github. To install it, click this button to download the compressed ZIP file then install it. This guide will help you with the install process if you have never installed an Arduino library.

Then you’ll have to do the same for the Adafruit GFX Graphics core library, available from github. Click the button to download it. Then install Adafruit_GFX just like the library you’ve done except this time name it Adafruit_GFX, etc.

Restart the Arduino software. You should see a new example folder called Adafruit_PCD8544 and inside, an example called pcdtest. Open up that sketch and upload it to your Arduino. You should see the example test sequence.

Graphics Library

We have a ready to go basic graphics library that has primitives for bitmaps, shapes and text. You can probably do everything you want using it. Because of the way the display works we need to buffer the entire display in ram which is 84×48 bits (504 bytes). However, screen updates are very fast.

For more details about the Adafruit GFX library, please visit http://learn.adafruit.com/adafruit-gfx-graphics-library – it supports lines, rectangles, roundrects, circles, text of different sizes etc.

Note that since this display is MONOCHROMATIC it only supports two colors: BLACK or WHITE. BLACK is a displayed dot and WHITE is for erasing pixels

Dont forget, after drawing anything to the screen, call display() to write it out to the LCD!

Downloads

Our PCD8544 (Nokia 5110) LCD display Arduino library is on github which comes with example code. This library uses 1/2 Kbytes of RAM since it needs to buffer the entire display but its very fast! The code is simple to adapt to any other microcontroller.

You’ll also need to get the Adafruit GFX Graphics core library which can print text, bitmaps, pixels, rectangles, circles and lines, also available on github.

The PCD8544 datasheet tells you all about what the display can do.

~learn.adafruit.com

 

https://raw.githubusercontent.com/wiki/olikraus/u8g2/img/uc1701_dogs102_uno_board_320.jpgGambar 5. [u8g2/wiki]

Library: LCD5110_Basic

Library: LCD5110_Graph

 

 

Save

Save

Save

Save

Save

Save

Save

Save

Save

Save

Save

Save

Save

Belajar penggunaan LCD “Nokia 5110” di sistem Arduino [video]

[ [ videos ] ]
[intense_tabs direction=”right” active_tab_background_color=”#000000″ active_tab_font_color=”#ffff00″ trigger=”click”] [intense_tab title=”Video01″ border=”3px solid #e8e8e8″ link_target=”_self” content_background_color=”#000000″ content_font_color=”#ffffff” icon_size=”1″ icon_position=”left”]

[/intense_tab] [intense_tab title=”Video02″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video03″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video04″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video05″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video06″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [/intense_tabs]
[intense_tabs direction=”right” active_tab_background_color=”#000000″ active_tab_font_color=”#ffff00″ trigger=”click”] [intense_tab title=”Video07″ border=”3px solid #e8e8e8″ link_target=”_self” content_background_color=”#000000″ content_font_color=”#ffffff” icon_size=”1″ icon_position=”left”]

[/intense_tab] [intense_tab title=”Video08″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video09″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video10″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video11″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video12″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [/intense_tabs]
[intense_tabs direction=”right” active_tab_background_color=”#000000″ active_tab_font_color=”#ffff00″ trigger=”click”] [intense_tab title=”Video13″ border=”3px solid #e8e8e8″ link_target=”_self” content_background_color=”#000000″ content_font_color=”#ffffff” icon_size=”1″ icon_position=”left”]

[/intense_tab] [intense_tab title=”Video14″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [intense_tab title=”Video15″ border=”3px solid #e8e8e8″ link_target=”_self” icon_size=”1″ content_background_color=”#000000″ content_font_color=”#ffffff” icon_position=”left”]

[/intense_tab] [/intense_tabs]

 

I²C LCD

[ [ images & links ] ]

Gambar 1.

Gambar 2.

Image result for i2c pcf8574 lcdGambar 3. [sumber]

Untuk lebih mudah mendeteksi alamat dari modul LCD pada sistem i2c, kita menggunakan i2c  scanner. Bagian berikut dikutip dari
https://playground.arduino.cc/Main/I2cScanner.

Last Modified: March 05, 2017, at 02:02 PM
By: Frode Grimstad Bang

 // --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found");
  else
    Serial.println("done");

  delay(5000);           // wait 5 seconds for next scan
}

Gambar 4.

Bagian berikut diadaptasi dari: 
http://www.carobot.cc/how-to/lcd-16×2-or-20×4-usage-guide/
Library: fdebrabander/Arduino-LiquidCrystal-I2C-library

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);

void setup()
{
  lcd.begin();
  lcd.backlight();
  lcd.print("tinker.");
  lcd.setCursor(0,1);
  lcd.print("sunupradana.info");
}

void loop()
{
}

Gambar 5.


Kode pengujian berikut terinspirasi dari komenter user bernama “turbiny” di halaman Instructables. Kode ini memanfaatkan pustaka dari Francisco Malpartida.

#include <Wire.h> // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h>

// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

Kode lengkap hasil modifikasi:

/* 

Dimodifikasi dari : 

YourDuino.com Example Software Sketch

20 character 4 line I2C Display

Backpack Interface labelled "LCM1602 IIC A0 A1 A2"

terry@yourduino.com 
*/

/*
Contoh kode tambahan: 
https://www.arduino.cc/en/Tutorial/
*/

/*-----( Import needed libraries )-----*/

#include <Wire.h> // Comes with Arduino IDE

// Get the LCD I2C Library here:

// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/

// Move any other LCD libraries to another folder or delete them

// See Library "Docs" folder for possible commands etc.

#include <LiquidCrystal_I2C.h>

/*-----( Declare Constants )-----*/

//none

/*-----( Declare objects )-----*/

// set the LCD address to LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); for a 16 chars 2 line display

// Set the pins on the I2C chip used for LCD connections:

// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

/*-----( Declare Variables )-----*/

//none

void setup() /*----( SETUP: RUNS ONCE )----*/

{

	Serial.begin(9600); // Used to type in characters

	lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines and turn on backlight

	//-------- Write characters on the display ----------------

	// NOTE: Cursor Position: CHAR, LINE) start at 0


	backLampu();

	posNol();
	delay(1000);
	lcd.clear();

	lcd.off();
	delay(1000);
	lcd.on();
	delay(1000);

	aturKursor();
	delay(1000);
	lcd.clear();

	noDis();
	delay(1000);
	lcd.clear();	
	
	geserKanan();
	delay(1000);
	
	autoGeserDemo();
	delay(500);

	kananKiri();
	delay(1000);
	

}/*--(end setup )---*/

void loop() /*----( LOOP: RUNS CONSTANTLY )----*/

{	
	// when characters arrive over the serial port...

	if (Serial.available()) 
	{
		uint8_t iCur = 0;

		// wait a bit for the entire message to arrive
		delay(100);
		// clear the screen
		lcd.clear();

		// read all the available characters
		while (Serial.available() > 0) 
		{

			// display each character to the LCD
			lcd.write(Serial.read());

			iCur++;
			if(iCur > 15)
			{
				iCur = 0;
				lcd.setCursor(0,1);
			}

		} //EOF while	
	} //EOF if
}/* --(end main loop )-- */

void backLampu()
{
	// ------- Quick 2 blinks of backlight -------------
	for(int i = 0; i< 2; i++)
	{
		lcd.noBacklight();
		delay(300);
		lcd.backlight();
		delay(200);		
	}

	// lcd.backlight(); // finish with backlight on
}

void posNol()
{
	lcd.setCursor(0,0); //Start at character 0 on line 0
	delay(1000);
	lcd.print("Kolom 0 Baris 0");
	delay(1000);
	lcd.setCursor(0,1);
	lcd.print("Kolom 0 Baris 1");
	delay(1000);
}


void aturKursor()
{
	lcd.setCursor(0,0); //Start at character 0 on line 0
	lcd.print("iic lcd");
	delay(1000);
	lcd.setCursor(6,1);
	lcd.print("6:1");
	delay(2000);
}

void noDis()
{
	lcd.noDisplay();
	delay(2000);
	lcd.display();
	delay(1000);		
}


void geserKanan()
{
	/* Arduino tutorial */

	lcd.setCursor(0,0);
	lcd.print("0");
	delay(1000);

	// scroll 29 positions (string length + display length) to the right
	// to move it offscreen right:
	for (int positionCounter = 0; positionCounter < 16; positionCounter++) 
	{
		// scroll one position right:
		lcd.scrollDisplayRight();
		// wait a bit:
		delay(200);
	}

	delay(400);

	lcd.clear();
	lcd.setCursor(0,1);
	lcd.print("0");
	delay(200);

	for (int positionCounter = 0; positionCounter < 16; positionCounter++) 
	{
		// scroll one position right:
		lcd.scrollDisplayRight();
		// wait a bit:
		delay(200);
	}

	delay(1000);
	lcd.clear();
}

void autoGeserDemo()
{
	/* Arduino tutorial */

	// set the cursor to (0,0):
	lcd.setCursor(0, 0);
	// print from 0 to 9:
	for (int thisChar = 0; thisChar < 10; thisChar++) 
	{
		lcd.print(thisChar);
		delay(500);
	}

	// set the cursor to (16,1):
	lcd.setCursor(16, 1);
	// set the display to automatically scroll:
	lcd.autoscroll();
	// print from 0 to 9:
	for (int thisChar = 0; thisChar < 10; thisChar++) 
	{
		lcd.print(thisChar);
		delay(500);
	}
	// turn off automatic scrolling
	lcd.noAutoscroll();

	// clear screen for the next loop:
	lcd.clear();
}


/* 
	Fungsi kananKiri dimodifikasi dari:
	https://www.arduino.cc/en/Tutorial/LiquidCrystalTextDirection 
*/
void kananKiri()
{

	int thisChar = 'a';

	lcd.clear();

	for(int i=0; i<26; i++)
	{
		// reverse directions at 'm':
		if (thisChar == 'm') 
		{
			lcd.clear();
			lcd.setCursor(12,0);
			// go right for the next letter
			lcd.rightToLeft();
		}
		// reverse again at 's':
		if (thisChar == 's') 
		{
			lcd.clear();
			lcd.setCursor(5,0);
			// go left for the next letter
			lcd.leftToRight();
		}
		// reset at 'z':
		if (thisChar > 'z') 
		{
			// go to (0,0):
			lcd.home();
			// start again at 0
			thisChar = 'a';
		}

		// print the character
		lcd.write(thisChar);
		// wait a second:
		delay(500);
		// increment the letter:
		thisChar++;	    
	}

	delay(800);
	lcd.clear();
}
/* ( THE END ) */

 

DFRobot LCD shield

Catatan untuk penggunaan LCD shield.

Ada dua versi dari LCD shield dari DFRobot yaitu versi 1.0 dan versi 1.1. Gambar 1 adalah V1.0 dan Gambar 2 adalah versi V1.1.

 

Gambar 1. [sumber]

File:DFR0009LCD KeyPad Shield mapping.pngGambar 2. [sumber]

 

Pada beberapa bagian kedua versi papan ini memiliki kesaamaan.

Gambar 3. [sumber]

DFR0009-PIN2.pngGambar 4. [sumber]

Contoh kode 01 [sumber]:

/*************************************************************************************

  Mark Bramwell, July 2010

  This program will test the LCD panel and the buttons.When you push the button on the shield,
  the screen will show the corresponding one.
 
  Connection: Plug the LCD Keypad to the UNO(or other controllers)

**************************************************************************************/

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);           // select the pins used on the LCD panel

// define some values used by the panel and buttons
int lcd_key     = 0;
int adc_key_in  = 0;

#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

int read_LCD_buttons(){               // read the buttons
    adc_key_in = analogRead(0);       // read the value from the sensor 

    // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
    // we add approx 50 to those values and check to see if we are close
    // We make this the 1st option for speed reasons since it will be the most likely result

    if (adc_key_in > 1000) return btnNONE; 

    // For V1.1 us this threshold
    if (adc_key_in < 50)   return btnRIGHT;  
    if (adc_key_in < 250)  return btnUP; 
    if (adc_key_in < 450)  return btnDOWN; 
    if (adc_key_in < 650)  return btnLEFT; 
    if (adc_key_in < 850)  return btnSELECT;  

   // For V1.0 comment the other threshold and use the one below:
   /*
     if (adc_key_in < 50)   return btnRIGHT;  
     if (adc_key_in < 195)  return btnUP; 
     if (adc_key_in < 380)  return btnDOWN; 
     if (adc_key_in < 555)  return btnLEFT; 
     if (adc_key_in < 790)  return btnSELECT;   
   */

    return btnNONE;                // when all others fail, return this.
}

void setup(){
   lcd.begin(16, 2);               // start the library
   lcd.setCursor(0,0);             // set the LCD cursor   position 
   lcd.print("Push the buttons");  // print a simple message on the LCD
}
 
void loop(){
   lcd.setCursor(9,1);             // move cursor to second line "1" and 9 spaces over
   lcd.print(millis()/1000);       // display seconds elapsed since power-up

   lcd.setCursor(0,1);             // move to the begining of the second line
   lcd_key = read_LCD_buttons();   // read the buttons

   switch (lcd_key){               // depending on which button was pushed, we perform an action

       case btnRIGHT:{             //  push button "RIGHT" and show the word on the screen
            lcd.print("RIGHT ");
            break;
       }
       case btnLEFT:{
             lcd.print("LEFT   "); //  push button "LEFT" and show the word on the screen
             break;
       }    
       case btnUP:{
             lcd.print("UP    ");  //  push button "UP" and show the word on the screen
             break;
       }
       case btnDOWN:{
             lcd.print("DOWN  ");  //  push button "DOWN" and show the word on the screen
             break;
       }
       case btnSELECT:{
             lcd.print("SELECT");  //  push button "SELECT" and show the word on the screen
             break;
       }
       case btnNONE:{
             lcd.print("NONE  ");  //  No action  will show "None" on the screen
             break;
       }
   }
}

Contoh kode 02 [sumber]:

/*******************************************************

   Description:
   Reads an analog input on pin 1, prints the result to the LCD.
   This program takes the temperture sensor LM35 for example. 
  
   Connection:
   Plug the LCD Keypad to the UNO(or other controllers)
   Temperture sensor:
   S(blue) -- A1()  
     Note: A0 has been occupied.
   VCC(red) -- VCC
   GND(black) -- GND

********************************************************/

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);        // select the pins used on the LCD panel

unsigned long tepTimer ;    

void setup(){ 
    lcd.begin(16, 2);                       // start the library
}

void loop(){ 
    lcd.setCursor(0, 0);                   // set the LCD cursor   position 
    int val;                               // variable to store the value coming from the analog pin 
    double data;                           // variable to store the temperature value coming from the conversion formula
    val=analogRead(1);                     // read the analog in value:
    data = (double) val * (5/10.24);       // temperature conversion formula
    
    if(millis() - tepTimer > 500){         // output a temperature value per 500ms 
             tepTimer = millis();

             // print the results to the lcd
             lcd.print("T: ");               
             lcd.print(data);             
             lcd.print("C");              
     } 
}

Contoh kode 03 [sumber]:

/*
DFRobot LCD Shield for Arduino
Key Grab v0.2
Written by Glendon Klassen
gjklassen@gmail.com
http://www.sourceforge.net/users/ecefixer
http://ecefixer.tumblr.com

Displays the currently pressed key on the LCD screen.

Key Codes (in left-to-right order):

None   - 0
Select - 1
Left   - 2
Up     - 3
Down   - 4
Right  - 5

*/

#include <LiquidCrystal.h>
#include <DFR_Key.h>

//Pin assignments for DFRobot LCD Keypad Shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); 
//---------------------------------------------

DFR_Key keypad;

int localKey = 0;
String keyString = "";
                 
void setup() 
{ 
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Key Grab v0.2");
  delay(2500);
  
  /*
  OPTIONAL
  keypad.setRate(x);
  Sets the sample rate at once every x milliseconds.
  Default: 10ms
  */
  keypad.setRate(10);

}

void loop() 
{ 
  /*
  keypad.getKey();
  Grabs the current key.
  Returns a non-zero integer corresponding to the pressed key,
  OR
  Returns 0 for no keys pressed,
  OR
  Returns -1 (sample wait) when no key is available to be sampled.
  */
  localKey = keypad.getKey();
  
  if (localKey != SAMPLE_WAIT)
  {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Current Key:");
    lcd.setCursor(0, 1);
    lcd.print(localKey);
  }
}