kopia lustrzana https://github.com/luigifcruz/pico-stuff
39 wiersze
782 B
C
39 wiersze
782 B
C
#include <stdio.h>
|
|
|
|
#define DEBUG
|
|
#include "bmp390.h"
|
|
|
|
int main() {
|
|
stdio_init_all();
|
|
|
|
while (getchar_timeout_us(0) != 'X') {
|
|
sleep_ms(10);
|
|
}
|
|
|
|
printf("Hello from Pi Pico!\n");
|
|
|
|
bmp_t bmp;
|
|
bmp.oss = 5;
|
|
bmp.i2c.addr = 0x77;
|
|
bmp.i2c.inst = i2c1;
|
|
bmp.i2c.rate = 400000;
|
|
bmp.i2c.scl = 3;
|
|
bmp.i2c.sda = 2;
|
|
|
|
if (!bmp_init(&bmp))
|
|
return 1;
|
|
|
|
while (true) {
|
|
if (!bmp_get_pressure_temperature(&bmp))
|
|
return 1;
|
|
printf("---------------------------------------------\n");
|
|
printf("Temperature (ºC): %f\n", bmp.temperature);
|
|
printf("Pressure (hPa): %f\n", bmp.pressure);
|
|
printf("Altitude (m): %f\n", bmp.altitude);
|
|
}
|
|
|
|
printf("Bye from pico!\n\n");
|
|
|
|
return 0;
|
|
}
|