Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/depau/go-iio-sensor-proxy

IIO Sensor Proxy bindings for Go
https://github.com/depau/go-iio-sensor-proxy

bindings dbus golang iio-sensor-proxy

Last synced: about 2 months ago
JSON representation

IIO Sensor Proxy bindings for Go

Awesome Lists containing this project

README

        

# iio-sensor-proxy - Go bindings

[iio-sensor-proxy](https://github.com/hadess/iio-sensor-proxy) bindings for Go, based on [godbus](https://github.com/godbus/dbus/)

### 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:

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

Get an instance of the sensor proxy:

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

Then use it:

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