readAcceleration
Read one sample of acceleration from BNO055 sensor
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
[
returns acceleration along x, y, and z axes of the BNO055 sensor as a 3-by-1 vector
in units of m/s2 along with the
accelReadings
,timestamp
] = readAcceleration(bno055
)timestamp
. In ndof
mode, the elements of
the vector represent calibrated values, whereas in amg
mode, the
elements represent raw values.
Examples
Read Acceleration Data from Sensor in NDOF Mode
Create an arduino
object
a = arduino('COM4', 'Uno', 'Libraries', 'I2C');
Create the BNO055 sensor object.
imu = bno055(a,'OperatingMode','ndof');
Calibrate the sensor using steps mentioned in Calibrate BNO055 Sensors
tic; while (toc < 120) [status,timestamp] = readCalibrationStatus(imu); if strcmpi(status.Accelerometer,'full') break; %Accelerometer is calibrated proceed further end pause(1); end
Read acceleration data.
[accelReadings,timestamp] = readAcceleration(imu)
accelReadings = 1×3 -1.4600 0.4300 -9.6000 timestamp = datetime 21-Jul-2020 15:47:59.835
Read Acceleration Data from Sensor in AMG Mode
Create an arduino
object
a = arduino('COM4', 'Uno', 'Libraries', 'I2C');
Create the BNO055 sensor object.
imu = bno055(a,'OperatingMode','amg');
Read acceleration data.
accelReadings = readAcceleration(imu)
accelReadings = -0.7023 0.1317 10.3968
Input Arguments
Output Arguments
More About
Version History
Introduced in R2019a
See Also
bno055
| flush
| info
| read
| readAngularVelocity
| readCalibrationStatus
| readMagneticField
| readOrientation
| release