I help need to set the time and date with the keypad, using RTC module

Hello I wanted to know how to edit the RTC time using keyboard

#include <RTClib.h>  //library: https://github.com/adafruit/RTClib
#include <Wire.h>
#include <Keypad.h>
#include <LiquidCrystal.h>

 
LiquidCrystal lcd(13, 12, 11, 10, 9, 8); //pines del arduino al LCD (RS E D4 D5 D6 D7) 


//Definición de filas y columnas
const byte Filas = 4; //Cuatro filas
const byte Cols = 4; //Cuatro columnas

//Definición de los pines
byte Pins_Filas[] = {3, 2, 1, 0}; //Pines Arduino para las filas
byte Pins_Cols[] =  {4, 5, 6, 7}; // Pines Arduino para las columnas


//Definición de las teclas
char Teclas [ Filas ][ Cols ] =
{
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

//Se crea una instancia llamada Teclado1 y el cual asignara las teclas que tenemos en el arreglo "Teclas" y le decimos
//que se han conectados los pines de las filas y columnas

Keypad kpd = Keypad(makeKeymap(Teclas), Pins_Filas, Pins_Cols, Filas, Cols);


int Fecha;
int Mes;
int Ano;
int Hora;
int Minutos;
int Segundos;



void display_tiempo();
void display_posicion(int digitos);
char Teclado ();
 

char kp;

RTC_DS1307 RTC;
 
void setup()
{
  Wire.begin(); 
  RTC.begin();

 RTC.adjust(DateTime(__DATE__, __TIME__)); 
 

  lcd.begin(16, 4); //Configura el LCD con el numero de columas y filas. Para un LCD 16x4: 16 columnas y 4 filas.
  lcd.display(); //Enciende el display
  lcd.clear();

  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);
  
}
 
void loop()
{

display_tiempo();


lcd.setCursor(0,3); lcd.print ("Press *");
char Tecla = kpd.getKey();

 if (Tecla == '*'){
  lcd.clear();
  lcd.setCursor(0,1); lcd.print ("Menu 1");
  lcd.setCursor(0,2); lcd.print ("Menu 2");
  kp = Teclado ();
  switch(kp){
    case '1':
            lcd.clear();
            lcd.setCursor(0,2); lcd.print ("1. LedOn");
            lcd.setCursor(0,3); lcd.print ("2. LedOff");
        
             kp = Teclado ();
                switch(kp){
                    case '1':
                          lcd.clear();
                          lcd.setCursor(0,2); lcd.print ("LedOn");
                          digitalWrite(A0, HIGH);
                          delay(50);
                          lcd.clear();
                    break;
                
                    case '2':
                          lcd.clear();
                          lcd.setCursor(0,2); lcd.print ("ledoff");
                          digitalWrite(A0, LOW);
                          delay(50);
                          lcd.clear();
                    break;
                }
    break;

    case '2':
            lcd.clear();
            lcd.setCursor(0,0); lcd.print ("set time");
              
              DateTime now = RTC.now(); //obtiene datos del modulo RTC
              
              lcd.setCursor(0,1);
              display_posicion(Hora); //Imprime Hora
              lcd.print(':');
              display_posicion(Minutos); //Imprime Minutos
              lcd.print(':');
              display_posicion(Segundos); //Imprime Segundos

              /*
               *
               *              this part is where I want to edit the time with keyboard
               *
               *
               *
               *
               *
               *
               *
               *
               *
               */
                       
 
          
         
          lcd.clear();
    break;
  }
  
 }
}


void display_tiempo(){
  
  DateTime now = RTC.now(); //obtiene datos del modulo RTC
  Fecha = now.day();
  Mes = now.month();
  Ano = now.year();
  
  
  Hora = now.hour();
  Minutos = now.minute();
  Segundos = now.second();

  lcd.setCursor(0,0);
  display_posicion(Fecha); //Imprime fecha
  lcd.print('/');
  display_posicion(Mes); //Imprime Mes
  lcd.print('/');
  display_posicion(Ano); //Imprime Año



  lcd.setCursor(0,1);
  display_posicion(Hora); //Imprime Hora
  lcd.print(':');
  display_posicion(Minutos); //Imprime Minutos
  lcd.print(':');
  display_posicion(Segundos); //Imprime Segundos
}


void display_posicion(int digitos){
    if(digitos < 10){lcd.print("0");}
    lcd.print(digitos);
}


char Teclado ()
{
  do{
    char Tecla = kpd.getKey();
   
    if (Tecla != NO_KEY)
    {
      return Tecla;
    }   
  } while (1);
}

I want to edit the time and date, and at the same time display on the display. examples:

Display:

set time

1: 00 h

If a key is pressed, increases hour

Display:

set time

2: 00 hour

Pressing another button, set the minutes

Display:

set time

2: 00 minutes

if you press a key, increases the minutes

Display:

set time

2: 01 minutes

Help, I'm new and I'm learning

Greetings beforehand.

(translate by google)

Use two counters, hr and min
You could then use * to increment hr/min and # to decrement.

.

LarryD:
Use two counters, hr and min
You could then use * to increment hr/min and # to decrement.

.

not be as increase and decrease the hours and minutes

case '2':
            lcd.clear();
            lcd.setCursor(0,0); lcd.print ("set time");
              
              DateTime now = RTC.now(); //obtiene datos del modulo RTC
              
              lcd.setCursor(0,1);
              display_posicion(Hora); //Imprime Hora
              lcd.print(':');
              display_posicion(Minutos); //Imprime Minutos
              lcd.print(':');
              display_posicion(Segundos); //Imprime Segundos


             kp = Teclado ();
                         
                 if(kp == 'C'){
                             
                Hora++; 
                if (Hora>23){Hora = 0;}
           }

           else if(kp == 'D'){
                  Hora--; 
                 if (Hora>23){Hora = 0;}
           }

Do not change the time

help

If you want help, please post your entire code.

It might be easier for you if you post in the Spanish language forum, here:
https://forum.arduino.cc/index.php?board=32.0

else if(kp == 'D'){
                  Hora--; 
                 if (Hora>23){Hora = 0;}
           }

if (Hora<0){Hora = 23;}

Yes it may be better to post in the Spanish area.

.

In Spanish is very small community, so they do not always respond.

Why not use the number keys to set the time? (Think of setting the time on a microwave oven.)

Maybe you will get inspiration from one of my projects.

This is a clock that allows you to set the date and time using only two buttons.
https://forum.arduino.cc/index.php?topic=408565.msg2823857#msg2823857