1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-14 19:29:32 +08:00
Homer Strong cdb26ad036 fix Port calls in leap motion adapter
"Message" should be capitalized to match event in driver

fix capitalization again (in example)

last event capitalization fix: hands example
2014-07-25 09:23:36 -07:00
..
2014-04-29 13:20:32 -07:00
2014-04-29 13:20:32 -07:00
2014-07-09 18:32:27 -07:00
2014-04-29 13:20:32 -07:00
2014-04-29 13:20:32 -07:00

Leap

This package provides the Gobot adaptor and driver for the Leap Motion

Getting Started

First install the Leap Motion Software

Now you can install the package with

go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/leap

Example

package main

import (
	"fmt"

	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/platforms/leap"
)

func main() {
	gbot := gobot.NewGobot()

	leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437")
	l := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap")

	work := func() {
		gobot.On(l.Event("Message"), func(data interface{}) {
			fmt.Println(data.(leap.Frame))
		})
	}

	robot := gobot.NewRobot("leapBot",
		[]gobot.Connection{leapMotionAdaptor},
		[]gobot.Device{l},
		work,
	)

	gbot.AddRobot(robot)

	gbot.Start()
}