Documentation
IPS_Sleep
boolean IPS_Sleep (int $WaitingTime)
Parameters
WaitingTime | Specifies the waiting time in milliseconds |
Returns
If the command succeeds, it returns TRUE, otherwise FALSE.
Description
The instruction exposes the execution of the script for WaitingTime milliseconds. After this time, the script continues. With this command short(!) waiting times can be realized. Longer waiting times should not be implemented by Sleep commands, but controlled through appropriate Events.
Since the lifetime of the script increased by WaitingTime, make sure that the maximum duration defined in the file "php.ini" will not be exceeded. Otherwise, the script exits with an error message. Longer waiting times in the range of several seconds or more should be implemented using other methods.
IPS_Sleep has no influence on other concurrently running scripts.
Alternatively, the PHP commands sleep(int seconds) or usleep(int microseconds) can be used.
Example
// Delayed data output to the COM port
COMPort_SendText($id, chr(0x1b)); // Sent ESC to LC-Display
IPS_Sleep(200); // Wait 200ms
COMPort_SendText($id, "0"); // Delete LC-Display
IPS_Sleep(200); // Wait 200ms
COMPort_SendText($id, "Good day!"); // Return Text
// Wait 2 seconds with PHP alternatives
sleep(2);
IPS_Sleep(2000);
usleep(2000000);