---
title: "Pressure: Air pressure readings"
canonical_url: https://developer.repebble.com/pebbleos/docs/samples/drivers/pressure/
last_updated: 2026-11-21
sdk_version: 4.44
---
# Pressure: Air pressure readings

Source: https://developer.repebble.com/pebbleos/docs/samples/drivers/pressure/

This sample reads the air pressure five times, a second apart, through `PRESSURE`: the board’s pressure sensor, whatever drives it. `pbl_pressure_read()` gives pascals; the sample prints hectopascals.

The reading is the pressure where the watch is, not corrected to sea level, so it is lower than a weather report’s by about 1.2 hPa for every 10 m of altitude. Only boards with a pressure sensor run it; the emulator has none.

Run:

`pbl samples samples/drivers/pressure`

Boards:

every board

## Sources

src/main.c

```
#include \<stdint.h\>#include \<stdio.h\>#include \<pbl/drivers/pressure.h\>#include \<pbl/kernel/delay.h\>#define READS 5int main(void) {for (int i = 0; i \< READS; i++) {uint32\_t pa;int ret;/\* Each read runs one conversion; the sensor sleeps in between. \*/ret = pbl\_pressure\_read(PRESSURE, &pa);if (ret != 0) {fprintf(stderr, "pressure: read failed (%d)\n", ret);return ret;}printf("pressure: %d.%02d hPa\n", (int)(pa / 100U), (int)(pa % 100U));pbl\_sleep\_ms(1000);}printf("Sample done\n");return 0;}
```

## Output

```
pressure: \d+\.\d\d hPa
pressure: \d+\.\d\d hPa
pressure: \d+\.\d\d hPa
pressure: \d+\.\d\d hPa
pressure: \d+\.\d\d hPa
Sample done
```

Generated from PebbleOS [4bbc630fa](https://github.com/coredevices/pebbleos/commit/4bbc630fa451369e352c06b8276c7fe37c67f4fd). This page is maintained in the pebbleos repository: [docs/samples/drivers/pressure.md](https://github.com/coredevices/pebbleos/blob/4bbc630fa451369e352c06b8276c7fe37c67f4fd/docs/samples/drivers/pressure.md).
