Skip to content

Instantly share code, notes, and snippets.

@1lann
Created April 14, 2016 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1lann/bfe11143bd81ec3164fd47310bf479c9 to your computer and use it in GitHub Desktop.
Save 1lann/bfe11143bd81ec3164fd47310bf479c9 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/i2c"
"github.com/hybridgroup/gobot/platforms/raspi"
"time"
)
func main() {
gbot := gobot.NewGobot()
rpi := raspi.NewRaspiAdaptor("abacus")
mpu := i2c.NewMPU6050Driver(rpi, "mpu6050")
work := func() {
gobot.Every(time.Millisecond*100, func() {
fmt.Println("Gyroscope:", mpu.Gyroscope)
})
}
robot := gobot.NewRobot("gyrobot",
[]gobot.Connection{rpi},
[]gobot.Device{mpu},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment