lsm303c
Connect LSM303C sensor on Raspberry Pi hardware I2C bus
Description
The lsm303c object reads ambient temperature, linear acceleration
and magnetic field along the X, Y, and Z axes using the STMicroelectronics® I2C-based LSM303C inertial measurement unit (IMU) sensor interfaced with the
Raspberry Pi® hardware. Before you use the lsm303c object, ensure that the
I2C interface is enabled on your Raspberry Pi kernel. You can then create a connection to the Raspberry Pi board using the raspi object and set its properties. For more
information, see raspi.
Note
To generate C/C++ code for this object and its associated functions, you must have an Embedded Coder® license.
Creation
Description
creates a LSM303C sensor object with default property values. The object represents a
connection to the sensor on the Raspberry Pi hardware sensor = lsm303c(mypi)mypi.
creates a LSM303C sensor object with properties using one or more
sensor = lsm303c(mypi,Name,Value)Name,Value arguments.
Input Arguments
Name-Value Arguments
Object Functions
readAcceleration | Read one acceleration data sample from LSM303C sensor |
readTemperature | Read one ambient temperature data sample from LSM303C sensor |
readMagneticField | Read one magnetic field data sample from LSM303C sensor |
Examples
Extended Capabilities
Version History
Introduced in R2021a
