Pebble.Hardware
Enhanced hardware access for Pebble watch devices.
Prefer the typed modules below — they match how Pebble apps are written in Elm:
- Pebble.Vibes for vibration - Pebble.Light for backlight - Pebble.System for battery and phone connection - Pebble.Speaker for tones and notes on speaker-equipped watches
This module exposes a lower-level command union for advanced integrations.
Types
VibrationType
type VibrationType
= Short
| Long
| Double
| NudgeTypes of vibration available.
VibrationPattern
type alias VibrationPattern = List ( Int, Int )Custom vibration patterns as a list of (duration_ms, pause_ms) pairs.
BacklightLevel
type BacklightLevel
= Off
| Low
| Medium
| High
| MaxBacklight intensity levels.
HardwareCmd
type HardwareCmd
= Vibrate VibrationType
| VibratePattern VibrationPattern
| SetBacklight BacklightLevel Int
| GetBatteryLevel (Int -> msg)
| GetConnectionStatus (Bool -> msg)
| PlayTone Int Int
| StopToneCommands for watch hardware operations.
Vibration
vibrate
vibrate : VibrationType -> HardwareCmd msgTrigger a simple vibration.
vibratePattern
vibratePattern : VibrationPattern -> HardwareCmd msgCreate a custom vibration pattern.
Backlight
setBacklight
setBacklight : BacklightLevel -> Int -> HardwareCmd msgSet backlight level for a specific duration.
enableBacklight
enableBacklight : HardwareCmd msgEnable backlight at medium level for 3 seconds.
disableBacklight
disableBacklight : HardwareCmd msgTurn off backlight immediately.
flashBacklight
flashBacklight : HardwareCmd msgFlash backlight for attention.
System Status
getBatteryLevel
getBatteryLevel : (Int -> msg) -> HardwareCmd msgGet current battery level (0-100).
getConnectionStatus
getConnectionStatus : (Bool -> msg) -> HardwareCmd msgCheck if connected to phone via Bluetooth.
Audio (if supported)
playTone
playTone : Int -> Int -> HardwareCmd msgPlay a tone at specific frequency and duration.
stopTone
stopTone : HardwareCmd msgStop any currently playing tone.