Main Content

readAcceleration

Read acceleration measured by the Accelerometer along x, y, and z axes

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

Description

example

Acceleration = readAcceleration(mysh) returns the acceleration measured by the Accelerometer along the x, y, and the z axis.

The unit of measurement for the Accelerometer data is meter per second square (m/s2)

example

[Acceleration,Ts]= readAcceleration(mysh) returns the acceleration measured by the Accelerometer along the x, y, and the z axis with timestamp.

example

accelerationRaw = readAcceleration(mysh,'raw') returns the acceleration measured by the Accelerometer along the x, y, and the z axis. The ‘raw’ argument is to specify that the output should be a uncalibrated raw data.

example

[accelerationRaw,Ts]= readAcceleration(mysh,'raw') returns the acceleration measured by the Accelerometer along the x, y, and the z axis with timestamp. The ‘raw’ argument is to specify that the output should be a uncalibrated raw data.

The full scale range for the Accelerometer is +/- 2g

Sense HAT IMU sensor axis information is shown below.

Examples

collapse all

You can read acceleration from the Accelerometer of Sense HAT.

acceleration = readAcceleration(mysh) 
acceleration =  

      -0.3045    0.2769   10.0417 

Read the acceleration from the Accelerometer along the x, y, and the z axis.

You can read acceleration and the timestamp from the Accelerometer of Sense HAT.

[acceleration, ts] = readAcceleration(mysensehat)  
acceleration = 

 -0.3045    0.2769   10.0417 

ts =  
  09-Aug-2016 15:37:19 

Read the acceleration from the Accelerometer along the x, y, and the z axes with the timestamp.

You can read raw uncalibrated acceleration value from the Accelerometer of Sense HAT

accelerationRaw = readAcceleration(mysh,'raw') 
accelerationRaw = 

   1.0e+05 * 

    0.0105    0.0204    1.6333 

Read the raw uncalibrated acceleration value from the Accelerometer along the x, y, and the z axis.

You can read raw uncalibrated acceleration value from the Accelerometer of Sense HAT along with the timestamp.

[accelerationRaw, ts ]= readAcceleration(mysh,'raw') 
accelerationRaw = 

   1.0e+05 * 

    0.0105    0.0204    1.6333 

ts = 

  09-Aug-2016 15:37:19 

Read the raw uncalibrated acceleration value from the Accelerometer along the x, y, and the z axis with the timestamp.

Input Arguments

collapse all

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

Argument to specify that the output should be a uncalibrated raw data.

Output Arguments

collapse all

The acceleration measured by the Accelerometer along the x,y, and z axes. This is a 1x3 double data. The unit of measurement for the Accelerometer data is meter per second square (m/s2).

Time at which the data is read.

Extended Capabilities

Version History

Introduced in R2016b