hybridgroup.gobot/platforms/spark
Adrian Zankich 1d24bd8866 Update READMEs 2014-07-10 17:02:00 -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
spark_core_adaptor.go Update spark package 2014-07-07 17:37:53 -07:00
spark_core_adaptor_test.go Update test formatting 2014-06-13 16:01:39 -07:00

README.md

Spark

This package provides the Gobot adaptor for the Spark Core

Installing

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

Example

package main

import (
	"time"

	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/platforms/gpio"
	"github.com/hybridgroup/gobot/platforms/spark"
)

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

	sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token")
	led := gpio.NewLedDriver(sparkCore, "led", "D7")

	work := func() {
		gobot.Every(1*time.Second, func() {
			led.Toggle()
		})
	}

	robot := gobot.NewRobot("spark",
		[]gobot.Connection{sparkCore},
		[]gobot.Device{led},
		work,
	)

	gbot.AddRobot(robot)

	gbot.Start()
}