hybridgroup.gobot/examples/leap_motion.go

25 lines
569 B
Go
Raw Normal View History

2014-04-28 08:43:15 +08:00
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
2014-05-23 11:35:45 +08:00
"github.com/hybridgroup/gobot/platforms/leap"
2014-04-28 08:43:15 +08:00
)
func main() {
2014-05-23 11:35:45 +08:00
gbot := gobot.NewGobot()
leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
leapMotionDriver := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap")
2014-04-28 08:43:15 +08:00
work := func() {
gobot.On(leap.Events["Message"], func(data interface{}) {
data.(leap.Frame)
})
}
2014-05-23 11:35:45 +08:00
gbot.Robots = append(gbot.Robots, gobot.NewRobot(
"leapBot", []gobot.Connection{leapMotionAdaptor}, []gobot.Device{leapMotionDriver}, work))
2014-04-28 08:43:15 +08:00
2014-05-23 11:35:45 +08:00
gbot.Start()
2014-04-28 08:43:15 +08:00
}