Toggle Button Timeout Using Millis()

cattledog:
I think there is a simple modification to the code which will allow for an unconditional time out of the togglebuttons. By making the switch between timing = true and timing = false dependent upon the switch release, we can keep the code from reentry into the block which turns the relays on. Calling the variable timing is not quite accurate for its new function, but I can't quite think of a better name.

I thought there were some issues with switch bounce on togglebutton release with this new code, so I added some debounce delay and repeated readings.

See if this version does what you want.

Thank you :wink:

By the way: Did you see my PM to you on May 28th? There is something that I would love if you consider.

the sketch is better and getting closer to what I intended it to be. However, I ran into another smaller obstacle (those obstacles seems to become smaller and smaller as I explore and talk to great people like you over the forum).

When ''togglebutton1'' is activated and held in activation, (via a relay in my case), it expires according to the interval specified, but it won't be able to execute an input from ''button1'' as long as the
''togglebutton1'' is activated. However, it will still be able to execute the if statement associated with ''button2'', and ''togglebutton2''. On the other hand, when ''togglebutton2'' is activated and held in position (due to the same relay set back to the other NO or NC status), it still expires after the specified time, and it will accept "togglebutton1" input only , but it WILL NOT execute "button1" or "button2" input during the hold. I spent like 2 hours of trial and error but without luck. Obviously I am missing the solid fundamentals of arduino, because my exposure is so little.

what I am trying to achieve, is, if the roller shutters were put all the way up or all the way down using the relay as trigger to "toggglebutton1" or "togglebutton2", to still be controllable either way using the momentary up or down buttons, without the toggle relay being disconnected. I wanted to make "button1", and "button2" responsive all the time, regardless of whether "toggle1" or "toggle2" activation status is.

I am amazed and humbled for the amount of knowledge and truth out there, and moreover, to the level of Karma and kindness some people have to offer. Thank you again.