Read one sample of barometric air pressure data from the sensor
Create an Arduino object and include the I2C library.
a = arduino();
Or, you can explicitly specify it in the
Libraries Name-Value pair
while creating the Arduino object.
clear a; a = arduino('COM4', 'Uno', 'Libraries', 'I2C');
Create the sensor object for the sensor in use.
pressureSensor = lps22hb(a);
Return one sample of pressure data.
pressureReading = readPressure(pressureSensor)
pressureReading = 9.5014e+04
pressureReading— Value read from the LPS22HB sensor
The barometric air pressure reading from the LPS22HB sensor, specified in Pascals (Pa).
The time at which MATLAB® receives pressure data from the sensor, specified as a datetime.
readPressure in a MATLAB Function block with the Simulink® Support Package for Arduino® Hardware to generate code that can be deployed on Arduino Hardware.
Timestamp returned is always in seconds.