vibrator.vibrate()


Type Function

Return value none

See also vibrator.*


Overview

Vibrates for a specified duration or with a specified pattern.

Syntax for a simple vibration

vibrator.vibrate(duration)

duration required

Integer. Duration of the vibration in milliseconds.

Syntax for a pattern vibration

vibrator.vibrate(pattern, [repeat])

pattern required

Array. An array of integers that are the durations for which to turn on and off the vibrator in milliseconds. The first value indicates the number of milliseconds to wait before turning the vibrator on. The next value indicates the number of milliseconds for which to keep the vibrator on before turning it off. Subsequent values alternate between durations in milliseconds to turn the vibrator off or to turn the vibrator on.

repeat optional

Integer. To make the pattern repeat, pass the index from the pattern array at which to start the repetition.