This is an example ESP-IDF application for the Sensirion SHT4x temperature and humidity sensor.
Edit main.c with the GPIO pins for your I²C SDA and SCL lines.
#define SDA GPIO_NUM_6
#define SDL GPIO_NUM_5
$ idf.py build flash monitor
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
...
I (277) main_task: Calling app_main()
I (277) main: version 0.1.0
I (307) sht4x: found device 0x108906f5
** 0 23.285648 30.964981
** 1 23.277637 30.985962
** 2 23.253605 31.016479
I (15337) main: heating....
** 3 26.308460 31.390326
** 4 23.248264 30.987869
** 5 23.226902 31.052719
...
On the third iteration, the heating capibility of the SHT4x sensor is activated.
A Python script is provided to visualize the temperature and humidity in real-time.
$ ./scripts/plot.py
See the component documunation to use this code as a component in your own project.
Bug reports and pull requests are very much encouraged.