05 Sensor API
Link to Source: samples/05_sensor
Overview
This sample demonstrates the use of Zephyr’s Sensor API to read temperature and humidity from a TI HDC1010 (or compatible) sensor via I2C.
This sample is useful for:
Understanding the Sensor API
Learning how to fetch and read sensor data
Working with I2C sensors
Requirements
This sample requires:
A board with I2C support (e.g., reel_board@2, nucleo_l496zg)
A TI HDC1010 or HDC1080 temperature/humidity sensor
Supported Boards:
reel_board@2
nucleo_l496zg (with external HDC sensor)
Building
For reel_board@2 (has onboard sensor):
host:~$ west build -b reel_board@2 samples/05_sensor -p
host:~$ west flash
For other boards with external sensor:
host:~$ west build -b nucleo_l496zg samples/05_sensor -p
host:~$ west flash
Sample Output
*** Booting Zephyr OS build v4.3.0 ***
Running on native_sim!
Dev 0x80525e0 name ti_hdc@43 is ready!
Fetching...
Temp = 4.059753 C, RH = 40.344238 %
Fetching...
Temp = 3.677062 C, RH = 45.675659 %
Fetching...
Temp = 4.165496 C, RH = 58.164978 %
Fetching...