Documentation
IPS_Sleep
bool IPS_Sleep (int $WaitingTime)
Parameters
| WaitingTime | Specifies the waiting time in milliseconds |
Returns
If the function succeeds, it returns TRUE, otherwise FALSE.
Description
The function suspends the execution of the script for WaitingTime milliseconds. After this time, the script continues. With this function short(!) waiting times can be realized. Longer waiting times should not be implemented using the Sleep function, but controlled through appropriate Events.
Scripts have no maximum runtime. However, during the WaitingTime the script still occupies one of the threads in which scripts are executed, and the number of these threads is limited. Longer waiting times in the range of several seconds or more should therefore be implemented using other methods.
IPS_Sleep has no influence on other concurrently running scripts.
Alternatively, the PHP functions sleep(int seconds) or usleep(int microseconds) can be used.
Example
// Delayed data output to the COM port
COMPort_SendText($id, chr(0x1b)); // Send ESC to LC display
IPS_Sleep(200); // Wait 200ms
COMPort_SendText($id, "0"); // Clear LC display
IPS_Sleep(200); // Wait 200ms
COMPort_SendText($id, "Good day!"); // Output text
// Wait 2 seconds with PHP alternatives
sleep(2);
IPS_Sleep(2000);
usleep(2000000);