1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-11 19:29:20 +08:00

41 lines
887 B
Markdown
Raw Normal View History

2014-07-06 14:17:10 -05:00
# Leap
2014-06-09 19:01:53 -07:00
This package provides the Gobot adaptor and driver for the [Leap Motion](https://www.leapmotion.com/)
## Getting Started
2014-06-09 19:01:53 -07:00
First install the [Leap Motion Software](https://www.leapmotion.com/setup)
Now you can install the package with
```
2014-07-06 14:17:10 -05:00
go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/leap
2014-06-09 19:01:53 -07:00
```
## Example
```go
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
2014-06-09 19:01:53 -07:00
"github.com/hybridgroup/gobot/platforms/leap"
)
func main() {
2014-06-09 19:01:53 -07:00
gbot := gobot.NewGobot()
adaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
l := leap.NewLeapMotionDriver(adaptor, "leap")
work := func() {
2014-06-09 19:01:53 -07:00
gobot.On(l.Events["Message"], func(data interface{}) {
fmt.Println(data.(leap.Frame))
})
}
2014-06-09 19:01:53 -07:00
gbot.Robots = append(gbot.Robots, gobot.NewRobot(
"leapBot", []gobot.Connection{adaptor}, []gobot.Device{l}, work))
2014-06-09 19:01:53 -07:00
gbot.Start()
}
2014-06-09 19:01:53 -07:00
```