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

Course Work

The document contains an Arduino code for a 4x4 keypad input system. It defines the keypad layout, sets up the pin connections, and includes a loop that responds to key presses with specific messages printed to the serial monitor. The code also controls a digital output based on the key pressed.

Uploaded by

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

Course Work

The document contains an Arduino code for a 4x4 keypad input system. It defines the keypad layout, sets up the pin connections, and includes a loop that responds to key presses with specific messages printed to the serial monitor. The code also controls a digital output based on the key pressed.

Uploaded by

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

#include <Keypad.

h>

const int ROW_NUM = 4; //four rows

const int COLUMN_NUM = 4; //four columns

char keys[ROW_NUM][COLUMN_NUM] = {

{'1','2','3', 'A'},

{'4','5','6', 'B'},

{'7','8','9', 'C'},

{'*','0','#', 'D'}

};

byte pin_rows[ROW_NUM] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad

byte pin_column[COLUMN_NUM] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );

void setup(){

Serial.begin(9600);

pinMode(10,1);

void loop(){

char key = keypad.getKey();

if (key=='1'){

// Serial.println("\n");

Serial.print("hellowwwww");

digitalWrite(10,1);

else if(key=='2'){

Serial.println("\n");
Serial.print("how are you");

digitalWrite(10,0);

else if(key=='3'){

Serial.println("\n");

Serial.print("am ok");

else if(key=='4'){

Serial.println("\n");

Serial.print("how are you too");

else if(key=='5'){

Serial.println("\n");

Serial.print("long time");

else if(key=='6'){

Serial.println("\n");

Serial.print("sure long time");

You might also like