main.cpp
360 Bytes
#include "mbed.h"
#include "LPS22HB.h"
// I2C Communication
I2C i2c(D14, D15); // SDA, SCL
LPS22HB baro(i2c, LPS22HB_G_CHIP_ADDR);
Serial pc(SERIAL_TX, SERIAL_RX);
int main() {
while( true){
baro.get();
pc.printf("Pressure: 0x%6.1f, Temperature: 0x%+4.1f\r\n", baro.pressure(), baro.temperature());
wait(1.0);
}
}