2014-10-17 23:05:21 +08:00
|
|
|
/*
|
2016-11-06 17:46:34 +08:00
|
|
|
Package particle provides the Gobot adaptor for the Particle Photon and Electron.
|
2014-10-17 23:05:21 +08:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
go get gobot.io/x/gobot && go install gobot.io/x/gobot/platforms/particle
|
2014-10-17 23:05:21 +08:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
|
|
|
"gobot.io/x/gobot/drivers/gpio"
|
|
|
|
"gobot.io/x/gobot/platforms/particle"
|
2014-10-17 23:05:21 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-10-02 00:28:28 +08:00
|
|
|
core := paticle.NewAdaptor("device_id", "access_token")
|
|
|
|
led := gpio.NewLedDriver(core, "D7")
|
2014-10-17 23:05:21 +08:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
|
|
|
led.Toggle()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-11-06 17:46:34 +08:00
|
|
|
robot := gobot.NewRobot("particle",
|
2016-10-02 00:28:28 +08:00
|
|
|
[]gobot.Connection{core},
|
2014-10-17 23:05:21 +08:00
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:37:10 +08:00
|
|
|
robot.Start()
|
2014-10-17 23:05:21 +08:00
|
|
|
}
|
|
|
|
|
2016-10-02 00:28:28 +08:00
|
|
|
For further information refer to Particle readme:
|
2016-12-21 17:55:03 +08:00
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/particle/README.md
|
2014-10-17 23:05:21 +08:00
|
|
|
*/
|
2016-12-08 20:24:03 +08:00
|
|
|
package particle // import "gobot.io/x/gobot/platforms/particle"
|