Class: Toybox::Attention::VibeProfile

Inherits:
Lang::Object show all

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.

Examples:

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:

  • 1.0.0

Supported Devices:

  • All devices except Edge / Oregon / Rino

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(dutyCycleVal, lengthVal) ⇒ VibeProfile

Create a new VibeProfile.

Since:

  • 1.0.0


2583
2584
# File 'Monkeybrains.rb', line 2583

def initialize(dutyCycleVal, lengthVal)
end

Instance Attribute Details

dutyCycleObject

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.

See Also:

Since:

  • 1.0.0


2575
2576
2577
# File 'Monkeybrains.rb', line 2575

def dutyCycle
  @dutyCycle
end

lengthObject

Length of the vibration in milliseconds (ms).

Since:

  • 1.0.0


2579
2580
2581
# File 'Monkeybrains.rb', line 2579

def length
  @length
end