action with Timer 5 times to following

hello

I have a stage that I want to switch to PLEG
the stage in question triggers a siren in case of detection of tampering

shutter button:
detection mvt = on
virtual switch = on

device:
switch virtual present = status

provided that:
present = 0 and virtual switch

Action if detection mvt goes to 1:
the siren is ON for 40 sec
then OFF for 15 sec
then back ON for 40 sec
then OFF for 15 sec

5 times to following

against by, if in the meantime, present goes to 1
we stop the siren and actions

I do not see how to realize this with the PLEG

an idea please?

Using State Variables would be my suggestion.

@RexBecket has an example in the PLEG Basics guide.

thank you for your answer

I saw the pdf
by cons, I completely blocks on the actions …

should I use many timer?

thank you

I did a simple test with only 1 timer
but it does not work

In the Action for the Condition Go you should target your PLEG device for the StartTimer action - not Program Logic Core.

Also you should change the Condition Arret to stop it firing too early:

Arret !Toff and (Go; !Toff)

thank you

dizzy

seen that it works, I modified in connection with the initial application
is it possible to improve this PLEG?