---
title: "Die temperature"
canonical_url: https://developer.repebble.com/pebbleos/docs/samples/drivers/temp/
last_updated: 2026-11-17
sdk_version: 4.44
---
# Die temperature

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

This sample reads the temperature of the chip five times, a second apart, through `DIE_TEMP`: the board’s die temperature sensor, whatever drives it. `pbl_temp_read()` gives millidegrees Celsius.

On a watch the reading follows the chip, a few degrees above the room and rising under load. The emulator’s simulated sensor reads a fixed 25 C.

Run:

`pbl samples samples/drivers/temp`

Boards:

every board

## Sources

src/main.c

```
#include \<stdint.h\>#include \<stdio.h\>#include \<stdlib.h\>#include \<pbl/drivers/temp.h\>#include \<pbl/kernel/delay.h\>#define READS 5int main(void) {for (int i = 0; i \< READS; i++) {int32\_t millicelsius;int ret;/\* DIE\_TEMP is the board's die temperature sensor, whatever drives it. \*/ret = pbl\_temp\_read(DIE\_TEMP, &millicelsius);if (ret != 0) {fprintf(stderr, "temp: read failed (%d)\n", ret);return ret;}printf("temp: %s%d.%d C\n", millicelsius \< 0 ? "-" : "", (int)(abs(millicelsius) / 1000),(int)(abs(millicelsius) % 1000 / 100));pbl\_sleep\_ms(1000);}printf("Sample done\n");return 0;}
```

## Output

```
temp: -?\d+\.\d+ C
temp: -?\d+\.\d+ C
temp: -?\d+\.\d+ C
temp: -?\d+\.\d+ C
temp: -?\d+\.\d+ C
Sample done
```

Generated from PebbleOS [9e782207f](https://github.com/coredevices/pebbleos/commit/9e782207f53f8f1c02f7b13ea40cdc092d7bab3d). This page is maintained in the pebbleos repository: [docs/samples/drivers/temp.md](https://github.com/coredevices/pebbleos/blob/9e782207f53f8f1c02f7b13ea40cdc092d7bab3d/docs/samples/drivers/temp.md).
