hybridgroup.gobot/platforms/spark
deadprogram fe057ba6bf misc: update all LICENSE files for current year
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-08-27 13:12:47 +02:00
..
LICENSE misc: update all LICENSE files for current year 2016-08-27 13:12:47 +02: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 tests: complete move of test interfaces into the test files where they belong 2016-08-27 11:56:01 +02:00
spark_core_adaptor_test.go tests: complete move of test interfaces into the test files where they belong 2016-08-27 11:56:01 +02: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()
}