This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ==== sleep ==== Pause script for a short duration === Description === <code>sleep( milliseconds )</code> Pause the script for ''milliseconds''. <WRAP center round important 60%> USE WITH CAUTION This command will prevent events to be executed and may cause unwanted delays in other logic. </WRAP> === Parameters === | ''milliseconds'' | The duration for which to pause the script | === Return value === This command does not return a value. === Example usage === <code javascript> main() { SetOutput(1, 100); sleep(200); // Allow output to be ON for 200 ms SetOutput(1, 0); } </code> An alternative to using the sleep function is to use a timer, like this: <code javascript> main() { SetOutput(1, 100); // Turn output on SetTimer(1, 200); // Set up timer 1 to trip in 200ms } @Timer( timerno, timeout, param ) { SetOutput(1, 0); // Turn output off } </code> One benefit of using a timer is that you code continues to execute while the timer is running. ezeio2/scriptref/sleep.txt Last modified: 2020-08-15 00:12by andreh Log In