Back to Nodemcu Firmware

L3G4200D Module

docs/modules/l3g4200d.md

latest891 B
Original Source

L3G4200D Module

SinceOrigin / ContributorMaintainerSource
2015-04-09Jason SchmidlappJason Schmidlappl3g4200d.c

This module provides access to the L3G4200D three axis digital gyroscope.

l3g4200d.read()

Samples the sensor and returns the gyroscope output.

Syntax

l3g4200d.read()

Returns

X,Y,Z gyroscope output

Example

lua
local sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
l3g4200d.setup()
local x,y,z = l3g4200d.read()
print(string.format("X = %d, Y = %d, Z = %d", x, y, z)

l3g4200d.setup()

Initializes the module.

Syntax

l3g4200d.setup()

Parameters

None

Returns

nil