# KEYPAD WITH 7 SEGMENT USING CLOUDX MICROCONTROLLER

230

2

## Introduction: KEYPAD WITH 7 SEGMENT USING CLOUDX MICROCONTROLLER

For this project, we will accept numeric input from a Matrix Keypad and then display it on a seven-segment display Module. Since the 8 LEDs are labeled A to G and DP (for the decimal point), if you want to display the number 6, then you would apply current to segments A, C,D,E F and G. Therefore 6 equals 0b01111101(DP,G,F,E,D,C,B,A) in binary and 0x7D in Hexadecimal.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: MATERIALS

1. CLOUDX MICROCONTROLLER
2. CLOUDX SOFTCARD
3. 7 SEGMENT
4. JUMPER WIRE
5. V3 CORD
6. 4x3 KEYPARD
7. 330 ohm
8. 10K resistor

YOU CAN ORDER YOUR COMPONENT HERE

## Step 2: SET-UP YOUR HARDWARE

connect the:

Pin A of the segment to pin1 of the CloudX

Pin B of the segment to pin2 of the CloudX

Pin DP of the segment to pin3 of the CloudX

Pin C of the segment to pin4 of the CloudX

Pin D of the segment to pin5 of the CloudX

Pin E of the segment to pin6 of the CloudX

Pin F of the segment to pin7 of the CloudX

Pin G of the segment to pin9 of the CloudX

connect the common cathode pin to GND

The pinA of the keypad row pin was connected to 10k resistor and to pin12 of the microcontroller.

The pinB of the keypad row pin was connected to 10k resistor and to pin13 of the microcontroller.

The pinC of the keypad row pin was connected to 10k resistor and to pin14 of the microcontroller.

The pinD of the keypad row pin was connected to 10k resistor and to pin15 of the microcontroller.

And the end of the resistor was connected together to GND.

The pin1 of the keypad Row pin was connected to pin10 of the microcontroller.

The pin2 of the keypad Row pin was connected to pin11 of the microcontroller.

The pin3 of the keypad Row pin was connected to pin12 of the microcontroller.

## Step 3: CODING

Copy this code to your CloudX IDE.

```#include <CloudX\M633.h>#include <CloudX\Keypad.h>
#include <CloudX\Segment.h>

#define NumberOfRows 4
#define NumberOfColumns 3
'1','2','3',
'4','5','6',
'7','8','9',
'*','0','#'
}; //layout of the Keypad’s Keys

char RowPins[NumberOfRows] = {12, 13, 14, 15};
char ColumnsPins[NumberOfColumns] = {9, 10, 11};
char Keys;
//Instead of creating ten separate char variables, we create an array to group them
unsigned char seg[] = {0x3F,0x06,0x5B,0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F};

setup(){
//setup here
//Segment_setting(CCathode,NumberOfDigit,segmentScanPins,segmentDataPins);
portMode(1,OUTPUT); // setup digital I/O port 1 as OUTPUT
portWrite(1, OFF_ALL); // clear/turn off port 1

loop(){
//Program here```
``` Keys = getKey(); // check for Key Press on Keypad
if(Keys!=0) portWrite(1, seg[Keys - 48]); // write Key Pressed on 7-segment```
```}
}```

## Step 4: SHARE WITH US

Share with us your Achievement here

8 2.6K
51 6.9K
112 8.8K