readHumidity
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
[
returns one sample of the relative humidity measured in humidityReading,timestamp] = readHumidity(humiditySensor)% along with the
timestamp. timestamp is optional.
Note
The readHumidity function is available for only the
HTS221 sensor.
Examples
Read humidity 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.
humiditySensor = hts221(a);
Return one sample of humidity data.
humidityReading = readHumidity(humiditySensor)
humidityReading = 69.6077
Input Arguments
Output Arguments
More About
Version History
Introduced in R2021a