multi keypress function using keypad.h library

please help me

kindly help me to program 4 digit input code command to call/execute while loop function

using hex keypad.

#include <Keypad.h>
 
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = {2,3,4,5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6,7,8,9}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );


void setup()
 {
 pinMode(LED_BUILTIN, OUTPUT);
}

void loop() 

{
  { 

	
  
   while(Key      ) 
   
  {digitalWrite(LED_BUILTIN, HIGH);   
  delay(1000);                       
  digitalWrite(LED_BUILTIN, LOW);    
  delay(1000); }                     
  



  [code]

while (Key )

{digitalWrite(LED_BUILTIN, HIGH);
delay(2000);
digitalWrite(LED_BUILTIN, LOW);
delay(2000);}

}
}
[/code]

Kindly help me to program multi keypress.

to call/ execute while loop function by sending a 4 digit (ex: "10AB" ) input command from HEX Keypad.

#include <Keypad.h>
 
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = {2,3,4,5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6,7,8,9}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );


void setup()
 {
 pinMode(LED_BUILTIN, OUTPUT);
}

void loop() 

{
  { 

	

   while(Key      ) 
   
  {digitalWrite(LED_BUILTIN, HIGH);   
  delay(1000);                       
  digitalWrite(LED_BUILTIN, LOW);    
  delay(1000); }                     
  



  while (Key      )

  {digitalWrite(LED_BUILTIN, HIGH);  
  delay(2000);                       
  digitalWrite(LED_BUILTIN, LOW);    
  delay(2000);}                       

  }
  }

Before going any further, look at the many examples, Google this topic.

Also, there are several YouTube videos you should go through on using keypads with the Arduino.

After you do some foot work and you still have trouble, ask for help.


BTW, new users are urged to not use delay() in their sketches.

Duplicate topics moved to the same forum section and merged

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a timeout from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.