Main Content

sensehat

Create a Sense HAT object passing raspi object

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

Description

mysh = sensehat(mypi) returns a sensehat object for the SenseHAT connected to the Raspberry Pi® board. Using the sensehat object, you can use the Humidity sensor, Pressure sensor, IMU sensor, read the joystick status, and control the LED Matrix.

SenseHAT is reserved for a single use at the time of object creation. Once an object is created for the SenseHAT, mysh in the example below, you can treat the SenseHAT as if it is connected to the host computer.

You cannot create multiple objects that refer to the same SenseHAT. You can create multiple SenseHAT objects provided that they are connected to different Raspberry Pi boards.

Use the senseHAT object to read values from different sensors as follows:

example

Examples

collapse all

You can create SenseHAT object passing raspi (Raspberry Pi) object as the first parameter to the constructor. Using this sensehat object, you can read the values from the sensors on-board, read the status of the job stick, and write to the LED Matrix.

Create a SenseHAT object mysh, from the MATLAB® software to the SenseHAT Board.

mysh = sensehat(mypi);

This function creates a senseHAT object ‘mysh’ for the SenseHAT connected to a Raspberry Pi board.

Input Arguments

collapse all

Connection to a specific Raspberry Pi hardware board, specified as a raspi object.

Output Arguments

collapse all

Extended Capabilities

Version History

Introduced in R2016b