modify example Statechangedetection code

I am trying to modify the example code for identifying a state change. Basically what i want to do is push a button to turn on a solenoid for 20 seconds, then after the 20 seconds the solenoid turns off. After the button is then pressed again I want nothing to happen. The next button push will then turn on the solenoid for 20 seconds repeating the cycle.

I have tried to modify the example code for State change detection but nothing is working for me. is there any way to modify this code to do what I want?

Sure there is.

Hope your also using the /Blink Without Delay example.

post your code using code tags (the </> symbol)

and we'll see what we can do to help. :slight_smile: