4 buttons controlling 1 relay? help!

hello :slight_smile:

I need some help with a relay and 4 push buttons.

I would like to have each button turn on the relay and the after X amount of seconds the relay turns off, example:

button 1= relay on 5 seconds then off until another button is pushed

button 1= relay on 10 seconds then off until another button is pushed

button 1= relay on 15 seconds then off until another button is pushed

button 1= relay on 20 seconds then off until another button is pushed

if someone could help me and write up some quick code for me that would be amazing. im not very good at coding so please do just leave an answer telling me to go and use blah and blah because I know nothing!

btw its a single relay being controlled by 4 different buttons.

have a look at the simple scheduler using millis()

Put your 4 buttons on 4 different pins. Then write a sketch that will set the timeout to the different values that you have. That should do it. No "quick code" needed.