hybridgroup.gobot/platforms/particle
deadprogram 24fa687dfe core: update Particle platform to simply return error
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-11-07 21:29:52 +01:00
..
LICENSE core: renaming Spark platform to Particle at long last 2016-10-01 18:11:26 +02:00
README.md particle: update docs to match latest API 2016-11-06 10:46:34 +01:00
adaptor.go core: no longer return slices of errors, instead use multierror 2016-11-07 21:29:51 +01:00
adaptor_test.go core: update Particle platform to simply return error 2016-11-07 21:29:52 +01:00
doc.go particle: update docs to match latest API 2016-11-06 10:46:34 +01:00

README.md

Particle

The Particle Photon and Particle Electron are connected microcontrollers from Particle (http://particle.io), the company formerly known as Spark Devices. The Photon uses a Wi-Fi connection to the Particle cloud, and the Electron uses a 3G wireless connection. Once the Photon or Electron connects to the network, it automatically connects with a central server (the "Particle 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 Photon or Electron.

For more info about the Particle platform go to https://www.particle.io/

How to Install

Installing Gobot with Particle support is pretty easy.

go get -d -u github.com/hybridgroup/gobot/... && go install github.com/hybridgroup/gobot/platforms/particle

How to Use

package main

import (
	"time"

	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/drivers/gpio"
	"github.com/hybridgroup/gobot/platforms/particle"
)

func main() {
	core := particle.NewAdaptor("device_id", "access_token")
	led := gpio.NewLedDriver(core, "D7")

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

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

	robot.Start()
}