2014-10-17 10:05:21 -05:00
|
|
|
/*
|
2014-10-28 14:52:59 -07:00
|
|
|
Package spark provides the Gobot adaptor for the Spark Core.
|
2014-10-17 10:05:21 -05:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
|
|
|
go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/spark
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
2016-10-01 18:28:28 +02:00
|
|
|
"github.com/hybridgroup/gobot/drivers/gpio"
|
|
|
|
"github.com/hybridgroup/gobot/platforms/particle"
|
2014-10-17 10:05:21 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-10-15 20:02:54 +02:00
|
|
|
gbot := gobot.NewMaster()
|
2014-10-17 10:05:21 -05:00
|
|
|
|
2016-10-01 18:28:28 +02:00
|
|
|
core := paticle.NewAdaptor("device_id", "access_token")
|
|
|
|
led := gpio.NewLedDriver(core, "D7")
|
2014-10-17 10:05:21 -05:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
|
|
|
led.Toggle()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("spark",
|
2016-10-01 18:28:28 +02:00
|
|
|
[]gobot.Connection{core},
|
2014-10-17 10:05:21 -05:00
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
|
|
|
gbot.AddRobot(robot)
|
|
|
|
|
|
|
|
gbot.Start()
|
|
|
|
}
|
|
|
|
|
2016-10-01 18:28:28 +02:00
|
|
|
For further information refer to Particle readme:
|
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/particle/README.md
|
2014-10-17 10:05:21 -05:00
|
|
|
*/
|
2016-10-01 18:28:28 +02:00
|
|
|
package particle
|