readPressure
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
[
returns one sample of the barometric air pressure measured in Pascals
(pressureReading,timestamp] = readPressure(pressureSensor)Pa) along with the timestamp.
timestamp is optional.
Note
The readPressure function is available for
LPS22HB and BMP280 sensor.
Examples
Read Pressure Data from 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
Input Arguments
Output Arguments
More About
Version History
Introduced in R2021a