Jump to content

Component: Accel / Mag 6-Axis (LSM303DLHC) (Movement Orientation)

From Flowcode Help
Revision as of 14:37, 13 July 2026 by SteveT (talk | contribs) (Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Author Matrix TSL
Version 2.0
Category Movement Orientation


Accel / Mag 6-Axis (LSM303DLHC) component

LSM303DLHC Combined 6-Axis Accelerometer and Magnetometer sensors Useful for working out data such as Pitch and Yaw.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_AccelMag_LSM303DLHC.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_AccelMag_LSM303DLHC.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples








Macro reference

CollectXYZData

CollectXYZData
Collect the data from the local accelerometer buffers. The Axis parameter specifies the Axis to be read. 0 / 'x' / 'X' - X axis 1 / 'y' / 'Y' - Y axis 2 / 'z' / 'Z' - Z axis 
- BYTE Axis
 
- INT Return


Initialise

Initialise
Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. 
- BYTE Return


SimReset1G

SimReset1G
 
- VOID Return


SimSetAccelerometer

SimSetAccelerometer
Allows the XYZ slider values to be set via the simulation 
- INT X
 
- INT Y
 
- INT Z
 
- VOID Return


SimSetCompass

SimSetCompass
Allows the XYZ slider values to be set via the simulation 
- INT X
 
- INT Y
 
- INT Z
 
- VOID Return


UpdateAccelerometerData

UpdateAccelerometerData
Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data 
- BYTE Return


UpdateCompassData

UpdateCompassData
Reads from the compass and updates the local XYZ variables. Returns 1 for new data and 0 for no new data 
- BYTE Return


Write_Register

Write_Register
Writes a data value to a specific register on the accelerometer 
- BYTE Reg
 
- BYTE Data
 
- BYTE Return


Property reference

Properties
Sensor Options
Power Mode
 
Accel Data Rate
 
Accel Scale
 
Compass Data Rate
 
Compass Scale
 
Comms Mode
Specifies the communications mode. Interrupt - Wait for the interrupt pin to go high before allowing new data to be sampled. Polling - New data is sampled without needing to check the interrupt pin. 
Bit Depth
 
Connections
Channel
Channel selection 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Simulation
Sim Type
Controls how the simulation data is generated, via the component GUI or via a I2C API. 
I2C
Scope Traces
Selects if the scope traces are automatically generated or not 
Console Data
Selects if the console data is automatically generated or not 
API