2014-10-17 23:43:48 +08:00
|
|
|
/*
|
2014-10-29 05:52:59 +08:00
|
|
|
Package leap provides the Gobot adaptor and driver for the Leap Motion.
|
2014-10-17 23:43:48 +08:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
|
2023-06-19 00:10:46 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
Install the [Leap Motion Software](https://www.leapmotion.com/setup).
|
2014-10-17 23:43:48 +08:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2023-05-20 20:25:21 +08:00
|
|
|
"gobot.io/x/gobot/v2"
|
|
|
|
"gobot.io/x/gobot/v2/platforms/leap"
|
2014-10-17 23:43:48 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-09-26 03:36:01 +08:00
|
|
|
leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437")
|
|
|
|
l := leap.NewDriver(leapMotionAdaptor)
|
2014-10-17 23:43:48 +08:00
|
|
|
|
|
|
|
work := func() {
|
2016-10-17 14:43:04 +08:00
|
|
|
l.On(l.Event("message"), func(data interface{}) {
|
2014-10-17 23:43:48 +08:00
|
|
|
fmt.Println(data.(leap.Frame))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("leapBot",
|
|
|
|
[]gobot.Connection{leapMotionAdaptor},
|
|
|
|
[]gobot.Device{l},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2024-02-11 22:34:50 +08:00
|
|
|
if err := robot.Start(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2014-10-17 23:43:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
For more information refer to the leap README:
|
2016-12-21 17:53:05 +08:00
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/leap/README.md
|
2014-10-17 23:43:48 +08:00
|
|
|
*/
|
2023-05-20 20:25:21 +08:00
|
|
|
package leap // import "gobot.io/x/gobot/v2/platforms/leap"
|