hybridgroup.gobot/examples/particle_function.go

28 lines
453 B
Go
Raw Normal View History

package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/particle"
)
func main() {
core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN")
work := func() {
if result, err := core.Function("brew", "202,230"); err != nil {
fmt.Println(err)
} else {
fmt.Println("result from \"brew\":", result)
}
}
robot := gobot.NewRobot("spark",
[]gobot.Connection{core},
work,
)
robot.Start()
}