hybridgroup.gobot/examples/particle_events.go

29 lines
441 B
Go

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 {
fmt.Println(err)
} else {
// TODO: some other way to handle this
fmt.Println(stream)
}
}
robot := gobot.NewRobot("spark",
[]gobot.Connection{core},
work,
)
robot.Start()
}