ztcl::device vibrate
Vibrates the device.
ztcl::device vibrate MS
ztcl::device vibrate -pattern LIST
Description
Vibrates for MS milliseconds, or with LIST, a pattern of times on and off: on, off, on, and so on. A time is 0 to 10,000 milliseconds, and a pattern has 1 to 64 times. On iOS a time or a pattern needs Core Haptics (iPhone 8 and later); ztcl::device haptic works on each phone.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| MS | integer | required | The time, 0 to 10,000 milliseconds. |
Returns
An empty string.
Examples
# A host with no vibrator, as a desktop.
% catch {ztcl::device vibrate 200} msg; set msg
vibration is not available on this platform
Errors
% ztcl::device vibrate 200
vibration is not available on this platform
-errorcode ZTCL DEVICE UNAVAILABLE
% ztcl::device vibrate 20000
bad time of vibration "20000": must be 0 to 10000 milliseconds
-errorcode ZTCL DEVICE VALUE
% ztcl::device vibrate -pattern {}
a pattern of vibration has 1 to 64 times
-errorcode ZTCL DEVICE VALUE
% ztcl::device vibrate
wrong # args: should be "ztcl::device vibrate ms|-pattern list"
-errorcode TCL WRONGARGS
Facts
- Capability
device. A new interpreter does not have it until the host turns it on.- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.6