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

Pebble C API

  • Pebble C API
  • Pebble JavaScript API
  • PebbleKit JS
  • PebbleKit iOS
  • PebbleKit Android
  • Foundation
    • App
    • App Communication
    • App Glance
    • AppMessage
    • AppSync
    • AppWorker
    • DataLogging
    • DataStructures
      • UUID
    • Dictation
    • Dictionary
    • Event Service
      • AccelerometerService
      • AppFocusService
      • BatteryStateService
      • CompassService
      • ConnectionService
      • HealthService
      • TickTimerService
    • Exit Reason
    • Internationalization
    • Launch Reason
    • Logging
    • Math
    • Memory Management
    • Platform
    • Resources
      • File Formats
    • Storage
    • Timer
    • Wakeup
    • Wall Time
    • WatchInfo
    • Rocky
  • Graphics
    • Draw Commands
    • Drawing Paths
    • Drawing Primitives
    • Drawing Text
    • Fonts
    • Graphics Context
    • Graphics Types
      • Color Definitions
  • User Interface
    • Animation
      • PropertyAnimation
    • Clicks
    • Layers
      • ActionBarLayer
      • BitmapLayer
      • MenuLayer
      • RotBitmapLayer
      • ScrollLayer
      • SimpleMenuLayer
      • StatusBarLayer
      • TextLayer
    • Light
    • Preferences
    • UnobstructedArea
    • Vibes
    • Window
      • ActionMenu
      • NumberWindow
    • Window Stack
  • Standard C
    • Format
    • Locale
    • Math
    • Memory
    • String
    • Time

Vibes

Controlling the vibration motor.

The Vibes API provides calls that let you control Pebble’s vibration motor.

The vibration motor can be used as a visceral mechanism for giving immediate feedback to the user. You can use it to highlight important moments in games, or to draw the attention of the user. However, you should use the vibration feature sparingly, because sustained use will rapidly deplete Pebble’s battery, and vibrating Pebble too much and too often can become annoying for users.

Function Documentation

void vibes_cancel(void)

Cancel any in-flight vibe patterns; this is a no-op if there is no on-going vibe.

void vibes_short_pulse(void)

Makes the watch emit one short vibration.

void vibes_long_pulse(void)

Makes the watch emit one long vibration.

void vibes_double_pulse(void)

Makes the watch emit two brief vibrations.

void vibes_enqueue_custom_pattern(VibePattern pattern)

Makes the watch emit a ‘custom’ vibration pattern.

Parameters

pattern

An arbitrary vibration pattern

See Also

VibePattern

Data Structure Documentation

struct VibePattern

Data structure describing a vibration pattern.

A pattern consists of at least 1 vibe-on duration, optionally followed by alternating vibe-off + vibe-on durations. Each segment may have a different duration.

Example code:

// Vibe pattern: ON for 200ms, OFF for 100ms, ON for 400ms:
static const uint32_t const segments[] = { 200, 100, 400 };
VibePattern pat = {
  .durations = segments,
  .num_segments = ARRAY_LENGTH(segments),
};
vibes_enqueue_custom_pattern(pat);

Data Fields

const uint32_t * durations

Pointer to an array of segment durations, measured in milli-seconds.

The maximum allowed duration is 10000ms.

uint32_t num_segments

The length of the array of durations.

See Also

vibes_enqueue_custom_pattern

Need some help?

Functions

  • vibes_cancel
  • vibes_short_pulse
  • vibes_long_pulse
  • vibes_double_pulse
  • vibes_enqueue_custom_pattern

Data Structures

  • VibePattern

Getting Help

Do you have questions about the Pebble SDK?

Do you need some help understanding something on this page?

You can either take advantage of our awesome developer community and check out the SDK Help forums, or you can send us a message through the website!