Created
April 14, 2016 02:01
-
-
Save 1lann/bc192ed1bcea1b8c2c76ddd206ecb4f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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