2015-07-02 14:40:13 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
"github.com/hybridgroup/gobot/platforms/leap"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
gbot := gobot.NewGobot()
|
|
|
|
|
|
|
|
leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
|
|
|
|
l := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap")
|
|
|
|
|
|
|
|
work := func() {
|
2016-09-01 12:17:43 +02:00
|
|
|
l.On(leap.GestureEvent, func(data interface{}) {
|
2015-07-02 14:40:13 -07:00
|
|
|
printGesture(data.(leap.Gesture))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("leapBot",
|
|
|
|
[]gobot.Connection{leapMotionAdaptor},
|
|
|
|
[]gobot.Device{l},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
|
|
|
gbot.AddRobot(robot)
|
|
|
|
|
|
|
|
gbot.Start()
|
|
|
|
}
|
|
|
|
|
|
|
|
func printGesture(gesture leap.Gesture) {
|
|
|
|
fmt.Println("Gesture", gesture)
|
|
|
|
}
|