Class: Toybox.Attention.VibeProfile

Overview

Define a vibration pattern.

Vibrations have two characteristics: duty cycle and length. These characteristics are used to define a single VibeProfile object, which can then be passed with a collection of other VibeProfile objects in an Array to the vibrate() method. The vibrate() method will play through each of the VibeProfile objects within the Array in order.

Example:

Build a set of VibeProfile objects

if (Attention has :vibrate) {
    vibeData =
    [
        new Attention.VibeProfile(25, 2000),
        new Attention.VibeProfile(50, 2000),
        new Attention.VibeProfile(100, 2000)
    ];
}

Since:

API Level 1.0.0

Supported Devices:

Instance Member Summary collapse

Instance Method Summary collapse

Instance Attribute Details

var dutyCycle as Lang.Number

The strength of the vibration.

Duty cycle is the felt strength of the vibration, and is analogous in practice to the frequency of the vibration. It is specified as a value from 0 to 100%, 0 indicating no vibration and 100 indicating the strongest vibration.

Since:

API Level 1.0.0

See Also:

var length as Lang.Number

Length of the vibration in milliseconds (ms).

Since:

API Level 1.0.0

Instance Method Details

initialize(dutyCycleVal as Lang.Number, lengthVal as Lang.Number)

Constructor

Parameters:

  • dutyCycleVal(Lang.Number)

    The strength of the vibration

  • lengthVal(Lang.Number)

    The length of the vibration in milliseconds (ms)

Since:

API Level 1.0.0


Generated Sep 23, 2024, 3:32:48 PM