Main Content

readTemperature

Read the temperature value from the Humidity sensor or the Air Pressure sensor

Add-On Required: This feature requires the MATLAB Support Package for Raspberry Pi Hardware add-on.

Description

example

temperature = readTemperature(mysh) returns the temperature read from the Humidity sensor. This is the default syntax of the function.

example

temperature = readTemperature(mysh,'usehumiditysensor') returns the temperature read from the Humidity sensor that you specify as an extra argument.

example

temperature = readTemperature(mysh,'usepressuresensor') returns the temperature read from the Air Pressure sensor that you specify as an extra argument.

Examples

collapse all

You can read the temperature from Sense HAT by using the following command.

readTemperature(mysh) 
ans = 

  305.0798 

Read the temperate from Sense HAT.

You can read the temperature from Humidity sensor of Sense HAT.

readTemperature(mysh,'usehumiditysensor') 
ans = 

  305.0798 

Read the temperature from the Humidity sensor by specifying ‘usehumiditysensor’ as an argument to the function.

You can read the temperature from the Air Pressure sensor of Sense HAT.

readTemperature(mysh,'usepressuresensor') 
ans = 

  304.3313 

Read the temperature from the Humidity sensor by specifying ‘usepressuresensor’ as an argument to the function

Input Arguments

collapse all

Connection to a SenseHAT board, specified as a sensehat object.

Argument to specify that the temperature has to be read from Humidity sensor.

Argument to specify that the temperature has to be read from Air Pressure sensor.

Output Arguments

collapse all

The temperature value read from the Humidity sensor or the Air Pressure sensor. The output of this method is a double and the unit of measurement for temperature is Kelvin (K).

Extended Capabilities

Version History

Introduced in R2016b