#include <stdio.h> #include <stdlib.h> #include <math.h> float pressure_hpa; int read_bmp280(float altitude) { FILE * fp; float station_pressure, sea_level_pressure; fp = fopen("/sys/bus/iio/devices/iio:device0/in_pressure_input", "r"); fscanf(fp, "%f", &station_pressure); fclose(fp); sea_level_pressure = station_pressure / powf(1.0f - (altitude / 44330), 5.255f); printf("Sea level pressure: %.4f\n", sea_level_pressure); pressure_hpa = sea_level_pressure * 10; return 0; }