Connect to LSM6DS3 sensor on Arduino hardware I2C bus
The lsm6ds3 object reads acceleration, angular velocity, and
temperature using the LSM6DS3 sensor connected to the I2C bus of the hardware. The LSM6DS3 is
an inertial measurement unit (IMU) used to read acceleration and angular velocity in all three
dimensions. The LSM6DS3 also has an embedded temperature sensor. Attach an LSM6DS3 sensor to
the I2C pins on the hardware. You can read the data from your sensor in MATLAB® using the Object Functions.
creates a sensor object with default property values.imu = lsm6ds3(a)
imu = lsm6ds3(a);.
creates a sensor object with properties using one or more imu = lsm6ds3(a,Name,Value)Name,Value
pair arguments.
imu = lsm6ds3(a,'I2CAddress',0x6A);.readAcceleration | Read one sample of acceleration from sensor |
readAngularVelocity | Read one sample of angular velocity from sensor |
readTemperature | Read one sample of temperature from sensor |
read | Read real-time sensor data at a specified rate using Sensor Fusion and Tracking Toolbox or Navigation Toolbox |
release | Release the sensor object |
flush | Flush the host buffer |
info | Read information related to sensor |
Create an arduino object with the I2C library.
a = arduino('COM4', 'Uno', 'Libraries', 'I2C');
Create the sensor object.
imu = lsm6ds3(a)
imu =
lsm6ds3 with properties:
I2CAddress: 106 ("0x6B")
SCLPin: "A5"
SDAPin: "A4"
Create a sensor object with properties available only with the Sensor Fusion and Tracking Toolbox or Navigation Toolbox.
clear imu; imu = lsm6ds3(a,'SampleRate',110,'SamplesPerRead',3,'ReadMode','Latest')
imu =
lsm6ds3 with properties:
I2CAddress: 107 ("0x6B")
Bus: 0
SCLPin: "A5"
SDAPin: "A4"
SampleRate: 110 (samples/s)
SamplesPerRead: 3
ReadMode: "latest"
SamplesRead: 0
SamplesAvailable: 0
Show all properties all functions