Update leap exxamples

This commit is contained in:
Adrian Zankich 2014-06-08 18:05:52 -07:00
parent 9ea4224193
commit 513213178a
2 changed files with 7 additions and 7 deletions

View File

@ -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()
} }

View File

@ -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()
} }