void setup()
{
// Start serial
Serial.begin(115200);
Serial.println("LPS28DFW Example 1 - Basic Readings!");
// Initialize the I2C library
Wire.begin();
// Check if sensor is connected and initialize
// Address is optional (defaults to 0x5C)
while(pressureSensor.begin(i2cAddress) != LPS28DFW_OK)
{
// Not connected, inform user
Serial.println("Error: LPS28DFW not connected, check wiring and I2C address!");
// Wait a bit to see if connection is established
delay(1000);
}
Serial.println("LPS28DFW connected!");
}
void loop()
{
// Get measurements from the sensor. This must be called before accessing
// the pressure data, otherwise it will never update
pressureSensor.getSensorData();
// Print temperature and pressure
Serial.print("Temperature (C): ");
Serial.print(pressureSensor.data.heat.deg_c);
Serial.print("\t\t");
Serial.print("Pressure (hPa): ");
Serial.println(pressureSensor.data.pressure.hpa);
// Only print every second
delay(1000);
Sorry I cannot follow your code and i am not familiar with your sensor. Go back and read the forum guidelines and post your code accordingly using code tags. Also post your annotated schematic and a link to your sensor that gives technical information, market place links such as azon and ae are generally useless.
With a new I2C sensor, always test communications by running the I2C Address Scanner program, and verify that the intended code uses the same I2C address that the sensor reports.
If the scanner program fails to detect the sensor, verify the wiring and whether the required pullup resistors are present on the SDA and SCL pins.
Logic level shifters are required when connecting a 5V Arduino and a 3.3V sensor.
the sensor is the lps28dfw like in the picture with the arduino code Example1_BasicReadings.ino (1,3 Ko)
all the time i got in the serial monitor ""LPS28DFW Example 1 - Basic Readings!"" means that the I2C communication does not work
when i'm running the code, the serial monitor indicate only ""LPS28DFW Example 1 - Basic Readings!" ", no pressure value .... means thant the I2C communication does not work.
Can you help me please ?
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.