Prerequisites:
- sudo raspi-config --> interfacing options --> enable i2c
- sudo apt install libi2c-dev i2c-tools
- determine i2c busses with i2cdetect -l
- determine BME280 device location and id with i2cdetect -y <bus number>
- edit DEV_ID / DEV_PATH in bme280.h if necessary
- edit LOCAL_HASL for local height above sea level, if required
Build / run
- make
- ./bme280
- ctrl-C to terminate
C code for the Raspberry Pi with the BME280 sensor, using direct calls to functions provided by libi2c-dev.
Readings are taken at a rate of 1 per second, in forced mode, oversampling x 1 and filter off. Data can be streamed with a measurement time down to 10 ms, with these settings, if needed.
Forced mode allows the sensor to sleep between readings.