Skip to content

depau/go-iio-sensor-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iio-sensor-proxy - Go bindings

iio-sensor-proxy bindings for Go, based on godbus

Note

This is my first Go project. It might not follow best practices, etc. If so, please do let me know ;)

Usage

$ go get github.com/Depau/go-iio-sensor-proxy

Get a connection to the system bus:

conn, err := dbus.SystemBus()
if err != nil {
    log.Fatal(err)
}

Get an instance of the sensor proxy:

sensorProxy, err := sensorproxy.NewSensorProxyFromBus(conn)
if err != nil {
    log.Fatal(err)
}

Then use it:

err := sensorProxy.ClaimAccelerometer()
// [handle error]
orientation, err := sensorProxy.GetAccelerometerOrientation()
// ...