1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-02 22:17:12 +08:00
hybridgroup.gobot/examples/particle_events.go
deadprogram 458c750f33 core: refactor/rename internal name of Master type
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-10-15 20:02:54 +02:00

33 lines
515 B
Go

package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/particle"
)
func main() {
gbot := gobot.NewMaster()
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,
)
gbot.AddRobot(robot)
gbot.Start()
}