Latch output for certain time with pushbutton

Hi all,

I’m planning to use a Arduino nano together with a relay module to switch an AC light source.

The goal is to have a momentary push button that when pressed turns the output pin connected to the relay high for a specified time (10 minutes).
But it should also be possible to turn the light off within the specified time by pressing the button again.

I have been looking around for any advice where to start, but unfortunately couldn’t find any information that suited my little project. (Maybe not using the right keywords)

If someone could point me in the right direction I would be very happy!

Welcome to the forum.
Look at the examples that come with the IDE.
Some of them do things like that with the onboard LED.
Test-drive a few of those sketches first.

Try to understand the BlinkWithoutDelay sketch.
Important if you want to be able to turn the light off during those 10 minutes.

Then replace the LED with a relay.
An Arduino pin can’t drive a relay directly.
You also need a transistor, diode, and base resistor.
Or use a relay module with those parts already mounted on the board.

Thank you! Somehow I did not think of the examples in the IDE. I already have a relay module that just needs the input pulled low to activate.

I'll look into the BlinkWithoutDelay sketch and try to make it work for me.