PX4 airspeed sensor v1.1 with Arduino

I am trying to use an airspeed sensor with an arduino. I am able to read the data coming from the sensor with this code:
#include <Wire.h>

// Define the I2C address for the PX4 Airspeed sensor
#define PX4_I2C_ADDRESS 0x28

void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
Wire.begin(); // Initialize I2C communication
delay(100); // Small delay to let everything initialize
}

void loop() {
int16_t differentialPressure = readDifferentialPressure();

// Display differential pressure in Pascal, if available
if (differentialPressure != -1) {
Serial.print("Differential Pressure ¶: ");
Serial.println(differentialPressure);
} else {
Serial.println(“Failed to read differential pressure”);
}

delay(1000); // Wait a second before the next reading
}

int16_t readDifferentialPressure() {
Wire.beginTransmission(PX4_I2C_ADDRESS);
Wire.write(0x00); // Request pressure data from the first register
Wire.endTransmission();

Wire.requestFrom(PX4_I2C_ADDRESS, 2); // Request 2 bytes for the differential pressure

if (Wire.available() == 2) {
uint8_t msb = Wire.read();
uint8_t lsb = Wire.read();

// Combine the MSB and LSB (assumes 14-bit data from the sensor)
int16_t pressure = ((msb << 8) | lsb) & 0x3FFF; // Mask to get the lower 14 bits

// Apply any necessary scaling based on the sensor datasheet here
// For example, if sensor range is ±1 PSI, you might convert to Pascals here

return pressure;

} else {
return -1; // Indicate an error in reading
}
}
Using this it outputs a pressure differential of 8000 Pa when stationary at ambient pressure. What is the problem?

Hey,
This is not a PX4 related question.

Maybe taking a look at how these druvers are impelemented will help you.