Fix robot command initialization

This commit is contained in:
Adrian Zankich 2014-06-07 20:57:51 -07:00
parent e1053fbdc5
commit 851b9bc48e
4 changed files with 4 additions and 4 deletions

View File

@ -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") })
},
)

View File

@ -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)

View File

@ -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"

View File

@ -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")
}