Maybe the state change detection is what you need? This is not just for buttons, but for any digital signal where you need to detect a certain transition or edge (high to low or low to high).
I don't understand your description of the functionality
if input D10 becomes HIGH switch D11 HIGH
keep D11 switched HIGH for 5 seconds
after 5 seconds switch D11 low
As long as input D10 stays HIGH do nothing
If input D10 has becomes low start checking again for input D10 becoming HIGH again?
You should post a description that names all details just in normal words.
mixing code and writing about "this" or "again" or "it" leads to a lot of misunderstandings.
In this description you should avoid all programming-terms as you might have mis-conceptions about the programming terms.
Another way of showing your wanted program-behaviour is to draw a freehand timing diagram. One diagram for each case that can occur.
Hello greatpam
If you are familar with coding in C++ it will be simple.
Make a structure containing all pin and timing information, a method will take care about these information will process it to get the desired project goal.
Do you mean:
whenever D10 becomes high it should on the led (D11) for 5 secs and then stop.
whenever D10 becomes LOW led should again on for 5 secs and then stop.
I have no idea what you mean by to stop repeating from here or jobdone type
post a handrawn timing diagram that shows how D10 and D11 should be switched low high
without seeing a timing diagram the only thing I can suggest is
your code has to detect any kind of state-change
to distinguish between now it is time to repeat the one-time-action of 5 seconds LED on then LED off from
it is not yet time to repeat the one-time-action of 5 seconds LED on then LED off
you see, Arduino is using an external pull down resistor to be able to read a button/switch which connects the pin to VCC.
Please read the description.
Do you understand that you need an external pulldown to be able to read the HIGH?
If yes, I ask you to either correct your wiring (with an external pulldown) or use the internal pullup and rewire your switch to close it to GND.
Let us know the outcome and post an udpated schematic of your wiring.