Martha MigliacioAlex Wong
Published © GPL3+

Using the Pmod KYPD with Arduino Uno

Application notes for Pmod KYPD and Arduino Uno. In this app, the activation of a key on the Pmod KYPD will be shown on the serial display.

EasyShowcase (no instructions)1 hour606
Using the Pmod KYPD with Arduino Uno

Things used in this project

Hardware components

Pmod KYPD
Digilent Pmod KYPD
×1
Pmod CLS
Digilent Pmod CLS
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Pmod KYPD, Pmod CLS, and Arduino Uno Fritzing file

Fritzing file displaying the connection of the Pmod KYPD, Pmod CLS, to the Arduino Uno.

Pmod KYPD, Pmod CLS, and Arduino Uno Fritzing Image

Fritzing image displaying the connection between the Pmod KYPD, Pmod CLS, and Arduino Uno.
Pmodkypd arduinouno bb p5jhbxp33n

Code

Pmod KYPD, Pmod CLS, and Arduino Uno Code

Arduino
This code will setup the activation of the keypads on the Pmod KYPD to be shown on the serial display.
/************************************************************************
*
* Test of the Pmod
*
*************************************************************************
* Description: Pmod_KYPD
* activation of a key on the keypad will be shown on serial display.
*
* Material
* 1. Arduino Uno
* 2. Pmod KYPD (dowload library http://playground.arduino.cc/Code/Keypad)
* 3. Pmod CLS (see instructions list on https://reference.digilentinc.com/pmod/pmod/cls/user_guide)
*
************************************************************************/

//Declaration of serial port
#include <SoftwareSerial.h>
SoftwareSerial lcd(12,13); // RX, TX

#include <Keypad.h>
const byte LIGNE = 4; // 4 lines
const byte COLONNE = 4; // 4 columms
char touche;

//Declaration of the key of the keypad
char hexaKeys[LIGNE][COLONNE] =
{
 {'1','2','3','A'},
 {'4','5','6','B'},
 {'7','8','9','C'},
 {'0','F','E','D'}
};
//Assignement of pin for the keypad
byte ligne_pin[LIGNE] = {2, 3, 4, 5};
byte colonne_pin[COLONNE] = {6, 7, 8, 9};
Keypad clavier = Keypad( makeKeymap(hexaKeys), ligne_pin, colonne_pin, LIGNE, COLONNE); // creation of object keypad

void setup()
{
 lcd.begin(9600); // initialization of serial communication of LCD display
 lcd.write("\x1b[j"); // Erase display
 lcd.write("\x1b[0h"); // configuration of the display (write on 2 lines)
}

void loop()
{
 lcd.write("\x1b[j"); // Erase display
 lcd.write("\x1b[0;4H"); // cursor is on line 1 and columm 4
 lcd.print("Appuyer");
 lcd.write("\x1b[1;1H"); // cursor is on line 2 and columm 51
 lcd.print("sur une touche");
 delay(100);
 touche=clavier.getKey(); // acquisition of the key
 if (touche!=0x00) // if there is not any key, function getKey send NULL character (0x00)
 {
 lcd.write("\x1b[j"); // Erase display
 lcd.print("Touche:");
 lcd.print(touche); // Show the key
 delay(1000);
 }
}

Credits

Martha Migliacio

Martha Migliacio

5 projects • 5 followers
Alex Wong

Alex Wong

5 projects • 13 followers
I work in Digilent and like creating projects
Thanks to Lextronics.

Comments

Add projectSign up / Login