0% found this document useful (0 votes)
14 views

IOT

The document describes an Arduino program to display values entered on a 4x4 keypad on a 7-segment display. It includes the theory of how a 7-segment display works using a shift register for control. The procedure has 7 steps and the code uses libraries for the keypad and shift register to read the keypad values and display them.

Uploaded by

kavithabanna06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

IOT

The document describes an Arduino program to display values entered on a 4x4 keypad on a 7-segment display. It includes the theory of how a 7-segment display works using a shift register for control. The procedure has 7 steps and the code uses libraries for the keypad and shift register to read the keypad values and display them.

Uploaded by

kavithabanna06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Aim: Arduino program to display keypad values on seven segment Display.

Theory: A Seven-segment display is used for displaying decimal


Numerals. It consists of 7 LED’s for saving the pin number for controlling a 7 segment display,
a shift register is used as a serial converter to send signals to the display. That is, we serially
send 8 bits of data, which represents the way want to turn ON the display.
The keypad is an input device. The purpose of having the keypad matrix is to reduce
the number of input pins. Here, we are using a 4*4 keypad matrix.

Procedure:
1. Start.
2. Import the libraries.
3. Create keymap for the keypad & other variables.
4. Declare an object for the shift register.
5. Display the key pressed on seven segment display.
6. Call delay.
7. End.

Code:
#include<shiftregister744c595.h>
#include<keypad.h>
const byte numRows=4;
const byte numCols=4;
char keymap[numRows][numCols]={
{‘1’,’2’,’3’},
{‘4’,’5’,’6’},
{‘7’,’8’,’9’},
{‘*’,’0’,’#’},
};
Char hex values [6]={B01011111,B01111100,B00111001,B01011110,B01111001,
B01110001};
ShiftRegister 744c595 sr (2,12,10,11);
Uint8_t
number[]={B001111111,B00000110,B01011011,BB01001111,B01100110,B01101101,
B01111101,B00000111,B0111111,B01101111};
byte colPins[numRows]={2,3,4,5};
byte rowPins[numCols]={6,7,8,9};
keypad mykeypad=keypad(‘makekeymap(keymap),rowPins,colPins,numRows,numCols);
void setup()
{serial.begin(9600);
}
Void loop()
{
Char keypreesed=mykeypad.getkey();
Serial.println(“keypressed:”+string(keypressed));
If (keypressed!=no.key)
{
Serial.print(keypressed);
Int i=keypressed-‘0’;
If(i<10)
{
Unit8_pinvalues[]={number[i],number[i]};
Sr.setall(pinvalues);
delay(100);
}
else{
i=keypressed-‘a’;
uint8_t pinvalues[]={hexvalues[i],hexvalues[i]};
sr.setall(pinvalues);
delay(100);
}
}
}
Result:
Arduino code was written to display keypad values on LCD.

You might also like