c64a0d9481
Signed-off-by: deadprogram <ron@hybridgroup.com> |
||
---|---|---|
.. | ||
LICENSE | ||
README.md | ||
doc.go | ||
spark_core_adaptor.go | ||
spark_core_adaptor_test.go |
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()
}