hybridgroup.gobot/platforms/leap
Adrian Zankich 1d24bd8866 Update READMEs 2014-07-10 17:02:00 -07:00
..
docs WIP project restructure 2014-04-29 13:20:32 -07:00
test/support WIP project restructure 2014-04-29 13:20:32 -07:00
LICENSE WIP project restructure 2014-04-29 13:20:32 -07:00
README.md Update READMEs 2014-07-10 17:02:00 -07:00
leap_motion_adaptor.go Update leap package 2014-07-07 17:19:31 -07:00
leap_motion_adaptor_test.go Update test formatting 2014-06-13 16:01:39 -07:00
leap_motion_driver.go Clean up drivers 2014-07-09 18:32:27 -07:00
leap_motion_driver_test.go Update test formatting 2014-06-13 16:01:39 -07:00
parser.go WIP project restructure 2014-04-29 13:20:32 -07:00

README.md

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()
}