Component: Accel Gyro 6 Axis LSM6DS3 (105020012) (Grove)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.1 (Release)
Category Grove


Image Accel Gyro 6_Axis LSM6DS3 (105020012) component

Combined 6-Axis Accelerometer and Gyroscope sensors. Useful for working out data such as Pitch and Roll. Can be combined with a Magnetometer to also provide Yaw.

It must be connected to the correct channel, also make sure that the SDA and SCL are connected to the right pins in flowcode. The Accelerometer/gyroscope needs to be initialised before any data can be called by it. It can also be configured to different sensitivity levels of acceleration. In flowcode the different axis can be specified as well as the simulation mode. There are different macros which allow you to get an accelerometer or gyroscope reading for an x, y or z coordinate, and even one to get a temperature reading from the component.

Examples

No additional examples


Downloadable macro reference

GetAccelReading

Collects one of the accelerometer readings from the last sample.

Parameters

BYTE Axis
0=X, 1=Y, 2=Z


Return value

INT


SampleDevice

Collects the accelerometer, gyro and temperature readings from the device,

Parameters

This macro has no parameters


Return value

This call does not return a value


GetGyroReading

Collects one of the gyroscope readings from the last sample.

Parameters

BYTE Axis
0=X, 1=Y, 2=Z


Return value

INT


GetTemperatureReading

Collects the Temperature readings from the last sample.

Parameters

This macro has no parameters


Return value

INT


ReadRegister

Reads the value from one of the registers onboard the device.

Parameters

BYTE Address


Return value

BYTE


WriteRegister

Sets the value of one of the registers on the device.

Parameters

BYTE Address
BYTE Value


Return value

This call does not return a value


Initialise

Startup the I2C bus and configure the device.

Returns 0 if the device is ok and 255 if the device is not responding correctly.

Parameters

This macro has no parameters


Return value

BYTE


Simulation macro reference

This component does not contain any simulation macros


Property reference

Gyro Range

This property is of type Fixed list of ints and can be referenced with the variable name GyroRange.

No additional information


Accel Range

This property is of type Fixed list of ints and can be referenced with the variable name AccelRange.

No additional information


Device Address

This property is of type Unsigned integer and can be referenced with the variable name DeviceAddress.

No additional information


Channel

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::CHANNEL.

Channel selection

SDA

This property is of type Single digital pin and can be referenced with the variable name cal_i2c1::SDA.

Pin used for SDA (data signal)

SCL

This property is of type Single digital pin and can be referenced with the variable name cal_i2c1::SCL.

Pin used for SCL (clock signal)

Baud Select

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::BAUD_LIST.

Baud rate option selector

Baud Rate

This property is of type Signed integer and can be referenced with the variable name cal_i2c1::BAUD.

Baud rate to be used

Stop Delay

This property is of type True or false and can be referenced with the variable name cal_i2c1::StopDel.

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.

Simulation Mode

This property is of type Fixed list of ints and can be referenced with the variable name SimulationGUI.

Chooses the data source for simulation.

Scope Traces

This property is of type True or false and can be referenced with the variable name cal_i2c1::ScopeTraces.

Selects if the scope traces are automatically generated or not

Console Data

This property is of type True or false and can be referenced with the variable name cal_i2c1::ConsoleData.

Selects if the console data is automatically generated or not

Injector

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::Injector.

No additional information