Blame view

Mbed_compiler/Read_Pressure_I2C/main.cpp 360 Bytes
1b3a0906   mbutaye   Ajout des fichier...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  #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);
      }
  }