Hi all, this will be fixed with the following PR: added check to correct i2C reading by Rocketct · Pull Request #2 · arduino-libraries/Arduino_LPS22HB · GitHub
The problem was don't wait for hardware cleaning of the one shot bit has reported in the issue.
the reading time is around 16 ms, in one shot mode.
it is possible change how the library is implemented and as you say the FIFO and/or the Continuous mode could reduce the readings time
Pay attention the interrupt are not available, the rails of the interrupts, as you can see on the schematics:
is not connected, then not available.
The sketch i used to make the test is the following:
#include <Arduino_LPS22HB.h>
long time0 = 0;
long time1 = 0;
long time2 = 0;
long time3 = 0;
long time4 = 0;
int a = 1;
void setup() {
Serial.begin(9600);
while (!Serial);
time0 = millis();
if (!BARO.begin()) {
Serial.println("Failed to initialize pressure sensor!");
while (1);
}
time1 = millis();
}
void loop() {
// read the sensor value
time3 = millis();
float pressure = BARO.readPressure();
time4 = millis();
if (a == 1) {
time2 = millis();
a = 0;
}
Serial.print("Initializaion sernsor time: ");
Serial.print(time1 - time0);
Serial.println(" ms");
Serial.print("from init to first reading: ");
Serial.print(time2 - time1);
Serial.println(" ms");
Serial.print("total time: ");
Serial.print(time2 - time0);
Serial.println(" ms");
Serial.print("readings time: ");
Serial.print(time4 - time3);
Serial.println(" ms");
// print the sensor value
Serial.print("Pressure = ");
Serial.print(pressure);
Serial.println(" kPa");
// print an empty line
Serial.println();
// wait 1 second to print again
delay(1000);
}
EDIT: i see after your comment about the int pin, then ok you already know