Show your work
Caveat I
@parky raises several valid objections; the OP should address those first. I made several assumptions below that could well be inconsistent with the problem statement; also, I did not stop the process after the fifth broken glass event.
Answers to what I think are the OP's questions
To start and stop the system I suggest the Start/Stop design pattern cf. Contact & Coil's
Patterns of Ladder Logic Programming web page (search for the terms in blue); that circuit is used in almost every ladder application, in a plethora of different forms.
Once you have done that, you need to separate the [run light] discrete output from the [running state] internal bit (the latter is controlled by the Start/Stop pattern above).
Then the task is to make the [run light] bit be
- solid 1 when the broken glass event count is less than 5
- flashing (1 then 0 then 1 ...) when that counter is 5 or more
There are many ways to flash a light (toggle a bit according to a repeating timer's state) that can be found on the 'net. E.g. there are several shown
here (although the focus there was on the precision of the timing).
After the OP does their search and research, and programs a flashing circuit, where there are two states (bits): flash-on; flash-off, there are the cases they will have to control:
- Light is 1 when flash-on is 1; count does not matter
- Light is 0 when flash-off is 1 and count is 5 or more
Note that flash-off = [NOT flash-on]. So the desired behavior can be restated as
- Light is on when flash-on is 1
- Light is off when flash-on is 0 and count is 5 or more
Case 2 can be inverted using one of
DeMorgan's Laws i.e.
- NOT(A and B) = (NOT A) or (NOT B)
to state when the light is not off:
- Light is on when flash-on is 1 (no change)
- NOT (Light is off) when NOT (flash-on is 0) OR NOT (count is 5 or more)
Removing the NOTs in the second case:
- NOT (Light is not off) is the same as (Light is on)
- NOT (flash-on is 0) is the same as (flash-on is 1)
- NOT (count is 5 or more) is the same as (count < 5)
So the two conditions now become:
- (Light is on) when (flash-on is 1)
- (Light is on) when (flash-on is 1) OR (count < 5)
Note that, although we have played with the expression of the second case, individually they still represent the logic of the original lines i.e. case 1 is when flash-on is 1, and case 2 is only used when flash-on is 0, i.e. for case 2 (flash-on is 0) is True and (flash-on is 1) is False. So the second case can be further simplified:
- (Light is on) when (flash-on is 1)
- (Light is on) when (False) OR (count < 5)
and because [False OR A] is A:
- (Light is on) when (flash-on is 1)
- (Light is on) when (count < 5)
Those two cases represent mutually exclusive and distinct time periods, which periods together represent all time. So those two cases can be combined to represent the state of the light for all time. Doing that combination and conversion to ladder is left as an exercise for the OP.
Caveat II
I showed all the logic steps in painful detail here because the OP seems to be new to the game; after some experience I am sure they will be doing all of those steps in their head and coding directly from the problem statement.
And finally,
here is a working example, with only the process model simulation shown.