well done as a first attempt. most important t elements are already inside
he basic principle of your code is correct.
In this version you use variables for all three button/LED combinations where it should be
three different sets of variables. On set of variables per Button/LED
You use the variables like if you would expect from
const byte LED_Pin = 5
to alternatively switch on LED1 or LED2 or LED3
Each LED needs its own set of variables.
You could name them just like the LED_Pins add a suffix “1” “2” “3”
to the variablename.
for each LED:
If a buttonpress is detected
- set a bool-variable to true
- store snapshot of millis() as ButtonPressStartTime
then your loop has another if-condition that is checking
buttonpress == true && is currentTime - ButtonPressStartTime bigger that the onTime
if yes set buttonpress to false
as long as
If buttonpress == true
switch LED on
switch LED off
This is enough for a functionality liek a stairway-light. Press Button light switches on for a certain time then switch light of
If the button is pressed while the light is on the countdown starts new
So modify your code and post your new version.
best regards Stefan