Update leap exxamples
This commit is contained in:
parent
9ea4224193
commit
513213178a
|
@ -9,16 +9,16 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
gbot := gobot.NewGobot()
|
gbot := gobot.NewGobot()
|
||||||
leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
|
leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
|
||||||
leapMotionDriver := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap")
|
l := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap")
|
||||||
|
|
||||||
work := func() {
|
work := func() {
|
||||||
gobot.On(leap.Events["Message"], func(data interface{}) {
|
gobot.On(l.Events["Message"], func(data interface{}) {
|
||||||
data.(leap.Frame)
|
fmt.Println(data.(leap.Frame))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
gbot.Robots = append(gbot.Robots, gobot.NewRobot(
|
gbot.Robots = append(gbot.Robots, gobot.NewRobot(
|
||||||
"leapBot", []gobot.Connection{leapMotionAdaptor}, []gobot.Device{leapMotionDriver}, work))
|
"leapBot", []gobot.Connection{leapMotionAdaptor}, []gobot.Device{l}, work))
|
||||||
|
|
||||||
gbot.Start()
|
gbot.Start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,16 +9,16 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
gbot := gobot.NewGobot()
|
gbot := gobot.NewGobot()
|
||||||
leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
|
leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
|
||||||
leapMotionDriver := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap")
|
l := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap")
|
||||||
|
|
||||||
work := func() {
|
work := func() {
|
||||||
gobot.On(leap.Events["Message"], func(data interface{}) {
|
gobot.On(l.Events["Message"], func(data interface{}) {
|
||||||
printHands(data.(leap.Frame))
|
printHands(data.(leap.Frame))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
gbot.Robots = append(gbot.Robots, gobot.NewRobot(
|
gbot.Robots = append(gbot.Robots, gobot.NewRobot(
|
||||||
"leapBot", []gobot.Connection{leapMotionAdaptor}, []gobot.Device{leapMotionDriver}, work))
|
"leapBot", []gobot.Connection{leapMotionAdaptor}, []gobot.Device{l}, work))
|
||||||
|
|
||||||
gbot.Start()
|
gbot.Start()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue