1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-01 13:48:57 +08:00
hybridgroup.gobot/examples/leap_motion_hands.go
deadprogram acfdbee0cb core: Convert all examples to use new Adaptor/Driver signatures
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-10-03 16:58:43 +02:00

36 lines
569 B
Go

package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/leap"
)
func main() {
gbot := gobot.NewGobot()
leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437")
l := leap.NewDriver(leapMotionAdaptor)
work := func() {
l.On(leap.HandEvent, func(data interface{}) {
printHand(data.(leap.Hand))
})
}
robot := gobot.NewRobot("leapBot",
[]gobot.Connection{leapMotionAdaptor},
[]gobot.Device{l},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}
func printHand(hand leap.Hand) {
fmt.Println("Hand", hand)
}