pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • Examples
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

Guides

  • Table of Contents
  • Alloy
    • Getting Started with Alloy
    • Piu UI Framework
    • Poco Graphics
    • Sensors and Input
    • Storage
    • Networking
    • App Messages
    • Watchfaces
    • Animations
    • Port (Custom Drawing)
    • Advanced Networking
    • Native Functions (FFI)
    • Dictation
    • Wakeups
    • Vibration
    • Device Info and App Events
  • App Resources
  • Best Practices
  • Communication
  • Debugging
  • Design and Interaction
  • Events and Services
  • Graphics and Animations
  • Pebble Packages
  • Pebble Timeline
  • Tools and Resources
  • User Interfaces

Vibration

The Vibes class drives the watch's vibration motor, letting your Alloy app provide haptic feedback. It offers a set of standard pulses as well as custom vibration patterns.

Platform Support: Vibration is available on Emery (Pebble Time 2) and Gabbro (Pebble Time 2 round).

Standard Pulses

import Vibes from "pebble/vibes";

Vibes.shortPulse();
Vibes.longPulse();
Vibes.doublePulse();
Method Description
Vibes.shortPulse() A single short vibration.
Vibes.longPulse() A single long vibration.
Vibes.doublePulse() Two short vibrations.

Custom Patterns

Pass an array of millisecond durations to pattern(). Durations alternate between on and off, starting with on:

import Vibes from "pebble/vibes";

// on 100ms, off 100ms, on 150ms, off 50ms, on 50ms, off 150ms, on 1000ms
Vibes.pattern([100, 100, 150, 50, 50, 150, 1000]);

Cancelling

Stop any ongoing vibration immediately:

Vibes.cancel();

Note: Vibration draws power and can be disruptive. Use it sparingly, and respect the user's Quiet Time settings for non-essential feedback.

See the hellovibes example for a complete project.

You need JavaScript enabled to read and post comments.

Overview

  • Standard Pulses
  • Custom Patterns
  • Cancelling