hybridgroup.gobot/platforms/spark
gmarik e494b9fb99 Refactor to use `gobottest` test helpers 2016-02-22 00:33:58 -05:00
..
LICENSE WIP project restructure 2014-04-29 13:20:32 -07:00
README.md Corrected dependency install instructions for all current platforms 2015-07-08 16:03:20 -07:00
doc.go Update docs 2014-10-28 14:52:59 -07:00
spark_core_adaptor.go Refactor and add tests 2014-12-28 08:04:15 -08:00
spark_core_adaptor_test.go Refactor to use `gobottest` test helpers 2016-02-22 00:33:58 -05:00

README.md

Spark

The Spark Core is a Wi-Fi connected microcontroller from Particle (http://particle.io), the company formerly known as Spark Devices. 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 -d -u 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()
}