Keypad user input timer switch without using delay()

How do you code a timer switch that sends a signal every specified hour with only using a keypad?
delay(); isnt good since it harms the whole code

Hello kuruto

Take a view into the IDE and find the BLINKWITHOUTDELAY example.

Hi @kuruto

welcome to the forum.

This is a somewhat unprecise description of the wanted functionality.
I guess entering hour and minute through a keypad
which one 3x4, 4x5 keys ?
matrix or analog ?

Signal: a short pulse ON then off again. how long shall the pulse endure?
or switching to a new state

best regards Stefan

I'm using a 4x4 matrix keypad. Im also using an i2c LCD to display the user input.
So basically I'm making an automated irrigation system where the user decides if the irrigation should be sensor based or timer based depending on the plant the user sowed. I already did the sensor based.
On the timer based, the user should be able to set the time when the system will water the plant (e.g. every 6 hours) then it will ask again how long is the duration of the watering (e.g. 10 seconds).
Also would it be possible without a real time clock?

Asking the user again directly after each other or after the 6 hours are over?
How many datasets do you want to store one single or more. If more how many?

The basic priciple is possible without a realtime-clock.
Any microcontroller can do timing. But the clock-frequency depends on manufacturing and temperature. The CPU-clock is not precise.
Depending on the microcontroller-type you may have a deviation of 2 or 3 seconds per day or even minutes per day.
You can compensate this to be more precise but you will not reach the precision of a RTC.

If you use a microcontroller like the ESP32 and do have a WLAN-connection you can use
Internettime.

So which microcontroller are you using?

I have it on an Arduino Mega 2560, I'm thinking it should have 3 datasets, 1 for how long should the system run, 1 for what hour should the solenoid valve turn on to begin irrigating, and 1 for how long will the solenoid valve be turned on. Once all 3 datasets are gathered, the system should be running continuously until the user decides to stop it.

Do you mean how long the system shall wait until start watering?

what is the difference between the time

and the time

Are you using a pulse-driven valve?

What you have described above would mean
set a time at which the watering starts
set a time how long the watering shall endure

and that's all.

After having watered for one single time the Arduino Mega shall stay idling until the user enters new data?

Boy or Girl I don't know. You should start thinking through the whole thing and then give a detailed description. You have an attitude of "I say please help" and then beeing extra-lazy waiting for all the detail-questions that take the work from you to think and analyse.

Maybe the problem is that english is not your native language. Well then use google-translate