hybridgroup.gobot/examples/particle_events.go

29 lines
441 B
Go
Raw Normal View History

package main
import (
"fmt"
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/particle"
)
func main() {
core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN")
work := func() {
if stream, err := core.EventStream("all", ""); err != nil {
2014-12-29 00:04:15 +08:00
fmt.Println(err)
} else {
// TODO: some other way to handle this
fmt.Println(stream)
}
}
robot := gobot.NewRobot("spark",
[]gobot.Connection{core},
work,
)
robot.Start()
}