Skip to main content

Simple Reading

This page shows a minimal example that reads temperature every 100 ms and prints it to the Serial Monitor.

Read temperature data

Open the Serial Monitor at 115200 baud to observe the temperature values.

#include "Soldered-TMP117.h"

// Default I2C address on this breakout is 0x49 (changeable via jumpers)
// Soldered_TMP117 tmp(0x48); // use this if you changed the address
Soldered_TMP117 tmp;

void setup() {
Wire.begin();
Serial.begin(115200);
tmp.init(NULL);
}

void loop() {
Serial.print("Temperature : ");
Serial.print(tmp.getTemperature());
Serial.println(" °C");
delay(100);
}

Function reference

tmp.init(void (*newDataCallback) = nullptr)

Initializes communication with the TMP117 sensor over I²C and prepares it for temperature measurement. Must be called once in setup().

Returns value: bool, true if initialization succeeded, false if the sensor was not detected

tmp.getTemperature()

Retrieves the most recent temperature measurement from the TMP117 sensor.

Returns value: float, Temperature value in degrees Celsius

SPK0641HT4H-1 Pinout
Dasduino CONNECTPLUS connected to TMP117 temperature sensor via Qwiic connector.

Serial Monitor output
Simple periodic temperature readout.

Full example

simpleReading.ino

Example that reads TMP117 temperature every 100 ms