diff --git a/examples/hello.go b/examples/hello.go index 819a414fd..67cf717e4 100644 --- a/examples/hello.go +++ b/examples/hello.go @@ -14,7 +14,7 @@ func main() { nil, nil, func() { - gobot.Every(0.5*time.Second, func() { fmt.Println("Greetings human") }) + gobot.Every(500*time.Millisecond, func() { fmt.Println("Greetings human") }) }, ) diff --git a/examples/hello_api.go b/examples/hello_api.go index 8267382ce..41ebb9816 100644 --- a/examples/hello_api.go +++ b/examples/hello_api.go @@ -12,7 +12,7 @@ func Hello(params map[string]interface{}) string { } func main() { - master := gobot.GobotMaster() + master := gobot.NewGobot() api.NewApi(master).Start() hello := gobot.NewRobot("hello", nil, nil, nil) diff --git a/examples/hello_api_auth.go b/examples/hello_api_auth.go index c51002dda..ffb0f988c 100644 --- a/examples/hello_api_auth.go +++ b/examples/hello_api_auth.go @@ -12,7 +12,7 @@ func Hello(params map[string]interface{}) string { } func main() { - master := gobot.GobotMaster() + master := gobot.NewGobot() server := api.NewApi(master) server.Username = "gort" diff --git a/robot.go b/robot.go index 72a88c980..9e6980724 100644 --- a/robot.go +++ b/robot.go @@ -44,7 +44,6 @@ func NewRobot(name string, c []Connection, d []Device, work func()) *Robot { } r.initName() log.Println("Initializing Robot", r.Name, "...") - r.initCommands() r.initConnections(c) r.initDevices(d) return r @@ -52,6 +51,7 @@ func NewRobot(name string, c []Connection, d []Device, work func()) *Robot { func (r *Robot) Start() { log.Println("Starting Robot", r.Name, "...") + r.initCommands() if err := r.Connections().Start(); err != nil { panic("Could not start connections") }