title: How to wait 1 second using Structured Text?
body: <p>I am currently writing a program that, when a variable reaches a certain point, a connected light will flash on and off every second. I know the light is properly hooked up, and I know that the program to alternate between on and off works, because it did it multiple times a second. I tried adding a wait timer to slow the flashing down.</p>
  
  <p>Here is the chunk of code I am trying to add:</p>
  
  <pre><code>VAR
      delay : TON;
      Count : INT := 0;
  END_VAR
  
  delay(IN := TRUE, PT:= T#5S);
      IF NOT (delay.Q) THEN
          RETURN;
      END_IF;
  
  delay(IN := FALSE);
  </code></pre>
  
  <p>When I add it to my code, I get the error invalid time constant.</p>
  
  <p>I'm not sure if it matters too much, but I am using Schneider Electric's EcoStruxure Machine Expert to write and execute my code.</p>
  
  <p>For those that wish to see the entire program, if it would help, here it is:</p>
  
  <pre><code>
  IF (change &lt; 70) THEN
      Light13 := FALSE;
  END_IF;
  
  IF (change &gt;= 70) AND (change &lt;= 90) THEN
      Light13 := TRUE;
  END_IF;
  
  IF (change &gt; 90) THEN
      WHILE change &gt; 90 DO
          IF (index MOD 2 = 0) THEN
              Light13 := TRUE;
  
          END_IF;
  
          IF (index MOD 2 &lt;&gt; 0) THEN
              Light13 := FALSE;
  
          END_IF;
  
          delay(IN := TRUE, PT:= T#5s);
              IF NOT (delay.Q) THEN
                  RETURN;
              END_IF;
  
          delay(IN := FALSE);
  
          index := index + 1;
  
      END_WHILE;
  
  END_IF;
  </code></pre>
  
  <p>To avoid getting a repeat question to this question, <a href="https://stackoverflow.com/questions/25682962/timers-in-plc-structured-text">Timers in PLC - Structured Text</a>, I will again reiterate that I am getting an error using this method. Just wanted to clarify beforehand.</p>
  
  <p>I am not at all set on using this way if there is a better option. Thanks for the help!</p>