Problem with code

So I'm trying to write code for sequential lights.

The idea is simple. The first LED lights up, the second one lights up 100ms after the first one and the third one lights up 100ms after the second one. Then once the input signal is low, all the LEDs turn off at the same time. That part of the code works fine.

The problem however is that I need to be able to stop the loop at any given moment. I thought if I update the digitalRead on the input pin and put break in an if statement, this would make it possible. But once I set input to 0, the loop doesn't terminate.

Please don't mind the ugly coding, it's just to show what I'm trying to achieve.


Please post your code using code tags </>

You should have based your sketch on the Blink Without Delay example.


You are changing the pin number associated with ind_signal to 1 or 0.

The forum guide lines describe how to post code to make it easier to help you. Pictures of code are most unhelpful and a pain in the rear to respond to.

And what ieee488 said.

Non-blocking timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().


The problem however is that I need to be able to ..........

You should not be investigating problems in a program that is 61.5k in size.

Write a short program (20 or 30 lines) to learn new techniques.

Alternatively, if the program worked when it was 61.0k in size the most recent changes must be the cause of the problem - what were they?