Back to

Package l3gd20

Latest Go to latest

The latest major version is .

Published: May 8, 2017 | License: MIT | Module:


Package l3gd20 allows interacting with L3GD20 gyroscoping sensor.



var (
	R250DPS  = &Range{sensitivity: 0.00875, value: 0x00}
	R500DPS  = &Range{sensitivity: 0.0175, value: 0x10}
	R2000DPS = &Range{sensitivity: 0.070, value: 0x20}

The three range settings supported by L3GD20.

type L3GD20

type L3GD20 struct {
	Bus   embd.I2CBus
	Range *Range
	// contains filtered or unexported fields

L3GD20 represents a L3GD20 3-axis gyroscope.

func New

func New(bus embd.I2CBus, Range *Range) *L3GD20

New creates a new L3GD20 interface. The bus variable controls the I2C bus used to communicate with the device.

func (*L3GD20) Close

func (d *L3GD20) Close() error


func (*L3GD20) OrientationDelta

func (d *L3GD20) OrientationDelta() (float64, float64, float64, error)

Orientation returns the current orientation reading.

func (*L3GD20) Orientations

func (d *L3GD20) Orientations() (<-chan Orientation, error)

Orientations returns a channel which will have the current temperature reading.

func (*L3GD20) Start

func (d *L3GD20) Start() error

Start starts the data acquisition loop.

func (*L3GD20) Stop

func (d *L3GD20) Stop() error

Stop the data acquisition loop.

func (*L3GD20) Temperature

func (d *L3GD20) Temperature() (int, error)

Temperature returns the current temperature reading.

type Orientation

type Orientation struct {
	X, Y, Z float64

type Range

type Range struct {
	// contains filtered or unexported fields

Range represents a L3GD20 range setting.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier