//go:build example // +build example // // Do not build by default. package main import ( "fmt" "gobot.io/x/gobot/v2" "gobot.io/x/gobot/v2/platforms/leap" ) func main() { 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, ) if err := robot.Start(); err != nil { panic(err) } } func printHand(hand leap.Hand) { fmt.Println("Hand", hand) }