hybridgroup.gobot/platforms/spark
deadprogram d884299c90 Merge branch 'master' into dev 2014-12-13 18:46:31 -08:00
..
LICENSE WIP project restructure 2014-04-29 13:20:32 -07:00
README.md update readmes for import script 2014-12-12 10:32:52 -08:00
doc.go Update docs 2014-10-28 14:52:59 -07:00
spark_core_adaptor.go Update platforms for new gpio interfaces 2014-11-29 11:51:16 -08:00
spark_core_adaptor_test.go Refactor spark to use new adaptor interface 2014-11-28 18:15:11 -08:00

README.md

Spark

The Spark Core contains a Wi-Fi connected microcontroller. Once it connects to a Wi-Fi network, it automatically connects with a central server (the "Spark Cloud") and stays connected so it can be controlled from external systems, such as a Gobot program. To run gobot programs please make sure you are running default tinker firmware on the Spark Core.

For more info about the Spark platform click here

How to Install

Installing Gobot with Spark support is pretty easy.

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

How to Use

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