This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

readAcceleration

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

Syntax

Acceleration = readAcceleration(mysh)
[Acceleration,Ts]= readAcceleration(mysh)
accelerationRaw = readAcceleration(mysh,raw)
[accelerationRaw,Ts]= readAcceleration(mysh,raw)

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

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2016b